1.10 |
Series of animations as a single animation. More...
#include <animation.h>
Public Member Functions | |
AnimationSequence (bool loop=false) noexcept | |
virtual void | add (const std::shared_ptr< detail::AnimationBase > &animation) |
Add a sub animation to the sequence. | |
template<class T > | |
void | add (const std::shared_ptr< T > &animation) |
Add an animation to the animation sequence. | |
virtual void | add (detail::AnimationBase &animation) |
Add an animation to the animation sequence. | |
bool | next () override |
Periodic call to the animation. | |
void | remove (detail::AnimationBase *animation) |
Remove the first occurence of a sub animation from the sequence. | |
void | removeAt (size_t pos) |
Remove the sub animation at the given position from the sequence. | |
void | removeLast () |
Remove the last sub animation from the sequence. | |
void | resume () override |
Resume the animation. | |
bool | skip () |
Skip to the next sub animation in the sequence. | |
void | start () override |
Start the animation. | |
void | stop () override |
Stop the animation. | |
Public Member Functions inherited from AnimationBase | |
AnimationBase ()=default | |
AnimationBase (AnimationBase &&) noexcept=default | |
AnimationBase (const AnimationBase &)=delete | |
virtual | ~AnimationBase () noexcept=default |
void | add_callback (AnimationCallback callback) |
Register a callback for the animation. | |
void | clear_callbacks () |
Clear all callbacks. | |
AnimationBase & | operator= (AnimationBase &&) noexcept=default |
AnimationBase & | operator= (const AnimationBase &)=delete |
virtual EGT_NODISCARD bool | running () const |
Returns true if the animation is currently running. | |
Protected Types | |
using | AnimationArray = std::vector< std::shared_ptr< detail::AnimationBase > > |
Helper type for an array of animations. | |
Protected Attributes | |
AnimationArray | m_animations |
The animations of the sequence. | |
size_t | m_current {0} |
Index of the current animation. | |
bool | m_loop {false} |
Should the animation sequence loop? | |
Protected Attributes inherited from AnimationBase | |
std::vector< AnimationCallback > | m_callbacks |
Registered callbacks for the animation. | |
bool | m_running {false} |
The running state of the animation. | |
Series of animations as a single animation.
It's often useful to put together a series of animations into a sequence. This class manages a series of animations objects and runs them as one big animation. You can even add animation sequences to other animation sequences to build up complex sequences.
You can skip the current sub-animation, you can restart to the beginning of the sequence, or you can stop the entire thing.
|
protected |
Helper type for an array of animations.
|
inlineexplicitnoexcept |
loop | Should the animation sequence loop. |
|
inlinevirtual |
Add a sub animation to the sequence.
animation | The animation. |
|
inline |
Add an animation to the animation sequence.
This will take a reference to the shared_ptr and manage the lifetime of the animation.
animation | The animation. |
|
inlinevirtual |
Add an animation to the animation sequence.
animation | The animation. |
|
inlineoverridevirtual |
Periodic call to the animation.
This must be called until it returns false. When it returns false, the animation is done.
Implements AnimationBase.
|
inline |
Remove the first occurence of a sub animation from the sequence.
animation | The animation. |
|
inline |
Remove the sub animation at the given position from the sequence.
pos | Position of the sub animation to remove. pos starts from 0. |
|
inline |
Remove the last sub animation from the sequence.
|
inlineoverridevirtual |
Resume the animation.
Implements AnimationBase.
|
inline |
Skip to the next sub animation in the sequence.
|
inlineoverridevirtual |
Start the animation.
Implements AnimationBase.
|
inlineoverridevirtual |
Stop the animation.
Implements AnimationBase.
|
protected |
The animations of the sequence.
|
protected |
Index of the current animation.
|
protected |
Should the animation sequence loop?