25#ifndef TGUI_ANIMATION_HPP
26#define TGUI_ANIMATION_HPP
28#include <TGUI/Layout.hpp>
29#include <TGUI/Duration.hpp>
72 class TGUI_API Animation
77 Animation(
const Animation&) =
default;
78 Animation(Animation&&) =
default;
79 Animation& operator=(
const Animation&) =
default;
80 Animation& operator=(Animation&&) =
default;
81 virtual ~Animation() =
default;
83 TGUI_NODISCARD AnimationType getType()
const;
85 virtual bool update(Duration elapsedTime) = 0;
86 virtual void finish();
89 Animation(AnimationType type, std::shared_ptr<Widget> widget, Duration duration, std::function<
void()> finishedCallback);
93 std::shared_ptr<Widget> m_widget;
95 Duration m_totalDuration;
96 Duration m_elapsedTime;
98 std::function<void()> m_finishedCallback;
103 class TGUI_API MoveAnimation :
public Animation
106 MoveAnimation(std::shared_ptr<Widget> widget, Vector2f start, Layout2d end, Duration duration, std::function<
void()> finishedCallback =
nullptr);
108 bool update(Duration elapsedTime)
override;
110 void finish()
override;
119 class TGUI_API ResizeAnimation :
public Animation
122 ResizeAnimation(std::shared_ptr<Widget> widget, Vector2f start, Layout2d end, Duration duration, std::function<
void()> finishedCallback =
nullptr);
124 bool update(Duration elapsedTime)
override;
126 void finish()
override;
129 Vector2f m_startSize;
135 class TGUI_API FadeAnimation :
public Animation
138 FadeAnimation(std::shared_ptr<Widget> widget,
float start,
float end, Duration duration, std::function<
void()> finishedCallback =
nullptr);
140 bool update(Duration elapsedTime)
override;
142 void finish()
override;
145 float m_startOpacity;
Namespace that contains all TGUI functions and classes.
Definition AbsoluteOrRelativeValue.hpp:36
ShowEffectType
Type of effect to show/hide widget.
Definition Animation.hpp:44
@ Fade
Fade widget in or out.
Definition Animation.hpp:45
@ SlideFromBottom
Slide from bottom to show or to the top to hide.
Definition Animation.hpp:55
@ SlideToLeft
Slide to the left to hide or from right to show.
Definition Animation.hpp:48
@ SlideToRight
Slide to the right to hide or from left to show.
Definition Animation.hpp:47
@ SlideFromLeft
Slide from left to show or to the right to hide.
Definition Animation.hpp:52
@ Scale
Shrink to the center of the widget to hide or grow from its center to show.
Definition Animation.hpp:46
@ SlideToBottom
Slide to the bottom to hide or from top to show.
Definition Animation.hpp:49
@ SlideFromTop
Slide from top to show or to the bottom to hide.
Definition Animation.hpp:54
@ SlideToTop
Slide to the top to hide or from bottom to show.
Definition Animation.hpp:50
@ SlideFromRight
Slide from right to show or to the left to hide.
Definition Animation.hpp:53
AnimationType
Type of animation.
Definition Animation.hpp:62
@ Move
Position is being changed.
Definition Animation.hpp:63
@ Resize
Size is being changed.
Definition Animation.hpp:64
@ Opacity
Opacity is being changed.
Definition Animation.hpp:65