25#ifndef TGUI_ANIMATION_HPP
26#define TGUI_ANIMATION_HPP
28#include <TGUI/Layout.hpp>
29#include <TGUI/Duration.hpp>
31#if !TGUI_EXPERIMENTAL_USE_STD_MODULE
38TGUI_MODULE_EXPORT
namespace tgui
74 class TGUI_API Animation
79 Animation(
const Animation&) =
default;
80 Animation(Animation&&) =
default;
81 Animation& operator=(
const Animation&) =
default;
82 Animation& operator=(Animation&&) =
default;
83 virtual ~Animation() =
default;
85 TGUI_NODISCARD AnimationType getType()
const;
87 virtual bool update(Duration elapsedTime) = 0;
88 virtual void finish();
91 Animation(AnimationType type, std::shared_ptr<Widget> widget, Duration duration, std::function<
void()> finishedCallback);
95 std::shared_ptr<Widget> m_widget;
97 Duration m_totalDuration;
98 Duration m_elapsedTime;
100 std::function<void()> m_finishedCallback;
105 class TGUI_API MoveAnimation :
public Animation
108 MoveAnimation(std::shared_ptr<Widget> widget, Vector2f start, Layout2d end, Duration duration, std::function<
void()> finishedCallback =
nullptr);
110 bool update(Duration elapsedTime)
override;
112 void finish()
override;
121 class TGUI_API ResizeAnimation :
public Animation
124 ResizeAnimation(std::shared_ptr<Widget> widget, Vector2f start, Layout2d end, Duration duration, std::function<
void()> finishedCallback =
nullptr);
126 bool update(Duration elapsedTime)
override;
128 void finish()
override;
131 Vector2f m_startSize;
137 class TGUI_API FadeAnimation :
public Animation
140 FadeAnimation(std::shared_ptr<Widget> widget,
float start,
float end, Duration duration, std::function<
void()> finishedCallback =
nullptr);
142 bool update(Duration elapsedTime)
override;
144 void finish()
override;
147 float m_startOpacity;
Namespace that contains all TGUI functions and classes.
Definition AbsoluteOrRelativeValue.hpp:38
ShowEffectType
Type of effect to show/hide widget.
Definition Animation.hpp:46
@ 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.
AnimationType
Type of animation.
Definition Animation.hpp:64
@ Move
Position is being changed.
@ Resize
Size is being changed.
@ Opacity
Opacity is being changed.