Animation
Inherited: None
Description
The Animation class contain basic state machine to control animation processing.
Public Methods
uint32_t |
currentLoop () const |
uint32_t |
currentTime () const |
int32_t |
duration () const |
bool |
isValid () const |
int32_t |
loopCount () const |
uint32_t |
loopTime () const |
void |
pause () |
void |
resume (bool ignore = false) |
void |
setCurrentTime (uint32_t msecs) |
void |
setLoopCount (int32_t loops) |
void |
setValid (bool valid) |
void |
start () |
Animation::State |
state () const |
void |
stop () |
int32_t |
totalDuration () const |
Public Enums
enum Animation::State
This enum defines the state of animation track.
Constant |
Value |
Description |
Animation::STOPPED |
0 |
Animation stopped if start() is triggered the animation will start from beginning. |
Animation::RUNNING |
1 |
Animation is playing. |
Animation::PAUSED |
2 |
Animation paused if resume() is triggered the animation will continue from place before pause(). |
Static Methods
None
Methods Description
uint32_t Animation::currentLoop () const
Returns the number of repetitions of animation which already has played.
uint32_t Animation::currentTime () const
Returns the current time (in milliseconds) in scope of current loop.
See also setCurrentTime().
int32_t Animation::duration () const
Returns the duration of the animation (in milliseconds).
bool Animation::isValid () const
Returns true in case of animation is valid; otherwise returns false.
int32_t Animation::loopCount () const
Returns the number of repetitions of animation; -1 in case of infinite animation.
See also setLoopCount().
uint32_t Animation::loopTime () const
Returns the current time for the current loop (in milliseconds).
void Animation::pause ()
Stops the animation.
Note: Animation CAN be continued by resume().
void Animation::resume (bool ignore = false)
Continues the animation which was paused earlier. Flag ignore can help to skip pause check.
void Animation::setCurrentTime (uint32_t msecs)
Sets the new position of animation to provided msecs position.
Note: If new position placed outside of current loop; Then current loop will be changed to appropriate.
See also currentTime().
void Animation::setLoopCount (int32_t loops)
Sets the new number of loops of animation; -1 in case of infinite animation.
See also loopCount().
void Animation::setValid (bool valid)
Sets the valid state of animation. The invalid animations will not affect anything.
See also isValid().
void Animation::start ()
Starts the animation from the beginning.
Animation::State Animation::state () const
Returns the current state of animation.
void Animation::stop ()
Stops the animation.
Note: Animation can’t be continued.
int32_t Animation::totalDuration () const
Returns the duration (in milliseconds) in total as sum of durations for all loops.
Note: Returns -1 in case of infinite animation.