26#ifndef TGUI_ANIMATION_HPP
27#define TGUI_ANIMATION_HPP
29#include <TGUI/Vector2f.hpp>
30#include <SFML/System/Time.hpp>
62 class TGUI_API Animation
74 Animation() =
default;
75 Animation(
const Animation&) =
default;
76 Animation(Animation&&) =
default;
77 Animation& operator=(
const Animation&) =
default;
78 Animation& operator=(Animation&&) =
default;
79 virtual ~Animation() =
default;
83 virtual bool update(sf::Time elapsedTime) = 0;
84 virtual void finish();
87 Animation(Type type, std::shared_ptr<Widget> widget, sf::Time duration, std::function<
void()> finishedCallback);
90 Type m_type = Type::None;
91 std::shared_ptr<Widget> m_widget;
93 sf::Time m_totalDuration;
94 sf::Time m_elapsedTime;
96 std::function<void()> m_finishedCallback;
101 class TGUI_API MoveAnimation :
public Animation
104 MoveAnimation(std::shared_ptr<Widget> widget, Vector2f start, Vector2f end, sf::Time duration, std::function<
void()> finishedCallback =
nullptr);
106 bool update(sf::Time elapsedTime)
override;
108 void finish()
override;
117 class TGUI_API ResizeAnimation :
public Animation
120 ResizeAnimation(std::shared_ptr<Widget> widget, Vector2f start, Vector2f end, sf::Time duration, std::function<
void()> finishedCallback =
nullptr);
122 bool update(sf::Time elapsedTime)
override;
124 void finish()
override;
127 Vector2f m_startSize;
133 class TGUI_API FadeAnimation :
public Animation
136 FadeAnimation(std::shared_ptr<Widget> widget,
float start,
float end, sf::Time duration, std::function<
void()> finishedCallback =
nullptr);
138 bool update(sf::Time elapsedTime)
override;
140 void finish()
override;
143 float m_startOpacity;
Namespace that contains all TGUI functions and classes.
Definition: AbsoluteOrRelativeValue.hpp:37
ShowAnimationType
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.