26#ifndef TGUI_ANIMATION_HPP
27#define TGUI_ANIMATION_HPP
29#include <TGUI/Layout.hpp>
30#include <TGUI/Duration.hpp>
58 using ShowAnimationType TGUI_DEPRECATED(
"ShowAnimationType was renamed to ShowEffectType") =
ShowEffectType;
65 class TGUI_API Animation
77 Animation() =
default;
78 Animation(
const Animation&) =
default;
79 Animation(Animation&&) =
default;
80 Animation& operator=(
const Animation&) =
default;
81 Animation& operator=(Animation&&) =
default;
82 virtual ~Animation() =
default;
86 virtual bool update(Duration elapsedTime) = 0;
87 virtual void finish();
90 Animation(Type type, std::shared_ptr<Widget> widget, Duration duration, std::function<
void()> finishedCallback);
93 Type m_type = Type::None;
94 std::shared_ptr<Widget> m_widget;
96 Duration m_totalDuration;
97 Duration m_elapsedTime;
99 std::function<void()> m_finishedCallback;
104 class TGUI_API MoveAnimation :
public Animation
107 MoveAnimation(std::shared_ptr<Widget> widget, Vector2f start, Layout2d end, Duration duration, std::function<
void()> finishedCallback =
nullptr);
109 bool update(Duration elapsedTime)
override;
111 void finish()
override;
120 class TGUI_API ResizeAnimation :
public Animation
123 ResizeAnimation(std::shared_ptr<Widget> widget, Vector2f start, Layout2d end, Duration duration, std::function<
void()> finishedCallback =
nullptr);
125 bool update(Duration elapsedTime)
override;
127 void finish()
override;
130 Vector2f m_startSize;
136 class TGUI_API FadeAnimation :
public Animation
139 FadeAnimation(std::shared_ptr<Widget> widget,
float start,
float end, Duration duration, std::function<
void()> finishedCallback =
nullptr);
141 bool update(Duration elapsedTime)
override;
143 void finish()
override;
146 float m_startOpacity;
Namespace that contains all TGUI functions and classes.
Definition AbsoluteOrRelativeValue.hpp:36
ShowEffectType
Type of animation to show/hide widget.
Definition Animation.hpp:44
@ Fade
Fade widget in or out.
@ SlideFromBottom
Slide from bottom to show or to the top to hide.
@ SlideToLeft
Slide to the left to hide or from right to show.
@ SlideToRight
Slide to the right to hide or from left to show.
@ SlideFromLeft
Slide from left to show or to the right to hide.
@ Scale
Shrink to the center of the widget to hide or grow from its center to show.
@ SlideToBottom
Slide to the bottom to hide or from top to show.
@ SlideFromTop
Slide from top to show or to the bottom to hide.
@ SlideToTop
Slide to the top to hide or from bottom to show.
@ SlideFromRight
Slide from right to show or to the left to hide.