Animation

Inherited: Object

Description

The Animation class contain basic state machine to control animation processing.

Public Methods

int

currentLoop () const

int

currentTime () const

int32_t

duration () const

bool

isValid () const

int32_t

loopCount () const

int

loopTime () const

void

pause ()

void

resume ()

void

setCurrentTime (int 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

int Animation::currentLoop () const

Returns the number of repetitions of animation which already has played.


int 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().


int 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 ()

Continues the animation which was paused earlier.


void Animation::setCurrentTime (int 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.