chromium/ui/gfx/animation/slide_animation.h

// Copyright 2012 The Chromium Authors
// Use of this source code is governed by a BSD-style license that can be
// found in the LICENSE file.

#ifndef UI_GFX_ANIMATION_SLIDE_ANIMATION_H_
#define UI_GFX_ANIMATION_SLIDE_ANIMATION_H_

#include <optional>

#include "base/memory/raw_ptr.h"
#include "ui/gfx/animation/linear_animation.h"
#include "ui/gfx/animation/tween.h"

namespace gfx {

// Slide Animation
//
// Used for reversible animations and as a general helper class. Typical usage:
//
// #include "ui/gfx/animation/slide_animation.h"
//
// class MyClass : public AnimationDelegate {
//  public:
//   MyClass() {
//     animation_.SetSlideDuration(base::Milliseconds(500));
//   }
//
//   void OnMouseEntered(const ui::MouseEvent& event) {
//     animation_.Show();
//   }
//
//   void OnMouseExited(const ui::MouseEvent& event) {
//     animation_.Hide();
//   }
//
//   void AnimationProgressed(const Animation* animation) {
//     CHECK_EQ(animation, &animation_);
//     hover_image_.SetOpacity(animation_.GetCurrentValue());
//   }
//
//  private:
//   SlideAnimation animation_{this};
// }
class ANIMATION_EXPORT SlideAnimation : public LinearAnimation {};

}  // namespace gfx

#endif  // UI_GFX_ANIMATION_SLIDE_ANIMATION_H_