26#ifndef TGUI_ANIMATION_HPP
27#define TGUI_ANIMATION_HPP
29#include <TGUI/Widget.hpp>
57 class TGUI_API Animation
68 virtual ~Animation() =
default;
72 virtual bool update(sf::Time elapsedTime) = 0;
74 virtual void finish();
77 Type m_type = Type::None;
80 sf::Time m_totalDuration;
81 sf::Time m_elapsedTime;
83 std::function<void()> m_finishedCallback;
90 class TGUI_API MoveAnimation :
public Animation
93 MoveAnimation(
Widget::Ptr widget, sf::Vector2f start, sf::Vector2f end, sf::Time duration, std::function<
void()> finishedCallback =
nullptr);
95 virtual bool update(sf::Time elapsedTime)
override;
97 virtual void finish()
override;
100 sf::Vector2f m_startPos;
101 sf::Vector2f m_endPos;
106 class TGUI_API ResizeAnimation :
public Animation
109 ResizeAnimation(
Widget::Ptr widget, sf::Vector2f start, sf::Vector2f end, sf::Time duration, std::function<
void()> finishedCallback =
nullptr);
111 virtual bool update(sf::Time elapsedTime)
override;
113 virtual void finish()
override;
116 sf::Vector2f m_startSize;
117 sf::Vector2f m_endSize;
122 class TGUI_API FadeAnimation :
public Animation
125 FadeAnimation(
Widget::Ptr widget,
float start,
float end, sf::Time duration, std::function<
void()> finishedCallback =
nullptr);
127 virtual bool update(sf::Time elapsedTime)
override;
129 virtual void finish()
override;
132 float m_startOpacity;
Namespace that contains all TGUI functions and classes.
Definition: Animation.hpp:34
ShowAnimationType
Type of animation to show/hide widget.
Definition: Animation.hpp:39
@ 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.