26#ifndef TGUI_ANIMATION_HPP
27#define TGUI_ANIMATION_HPP
29#include <TGUI/Layout.hpp>
30#include <TGUI/Duration.hpp>
32#if !TGUI_EXPERIMENTAL_USE_STD_MODULE
39TGUI_MODULE_EXPORT
namespace tgui
77 class TGUI_API Animation
82 Animation(
const Animation&) =
default;
83 Animation(Animation&&) =
default;
84 Animation& operator=(
const Animation&) =
default;
85 Animation& operator=(Animation&&) =
default;
86 virtual ~Animation() =
default;
88 TGUI_NODISCARD AnimationType getType()
const;
90 virtual bool update(Duration elapsedTime) = 0;
91 virtual void finish();
94 Animation(AnimationType type, std::shared_ptr<Widget> widget, Duration duration, std::function<
void()> finishedCallback);
98 std::shared_ptr<Widget> m_widget;
100 Duration m_totalDuration;
101 Duration m_elapsedTime;
103 std::function<void()> m_finishedCallback;
108 class TGUI_API MoveAnimation :
public Animation
111 MoveAnimation(std::shared_ptr<Widget> widget, Vector2f start, Layout2d end, Duration duration, std::function<
void()> finishedCallback =
nullptr);
113 bool update(Duration elapsedTime)
override;
115 void finish()
override;
124 class TGUI_API ResizeAnimation :
public Animation
127 ResizeAnimation(std::shared_ptr<Widget> widget, Vector2f start, Layout2d end, Duration duration, std::function<
void()> finishedCallback =
nullptr);
129 bool update(Duration elapsedTime)
override;
131 void finish()
override;
134 Vector2f m_startSize;
140 class TGUI_API FadeAnimation :
public Animation
143 FadeAnimation(std::shared_ptr<Widget> widget,
float start,
float end, Duration duration, std::function<
void()> finishedCallback =
nullptr);
145 bool update(Duration elapsedTime)
override;
147 void finish()
override;
150 float m_startOpacity;
Namespace that contains all TGUI functions and classes.
Definition AbsoluteOrRelativeValue.hpp:39
ShowEffectType
Type of effect to show/hide widget.
Definition Animation.hpp:47
@ 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:66
@ Move
Position is being changed.
@ Resize
Size is being changed.
@ Opacity
Opacity is being changed.