Public Types | Public Member Functions | Static Public Member Functions | List of all members
ime::Animation Class Reference

A SpriteSheet/frame based animation. More...

#include <Animation.h>

Public Types

enum class  Direction { Forward , Reverse , Alternate_Forward , Alternate_Reverse }
 The playing direction of the animation. More...
 
using Ptr = std::shared_ptr< Animation >
 Shared animation pointer. More...
 

Public Member Functions

 Animation (const std::string &name, const SpriteSheet &spriteSheet, const Time &duration=Time::Zero)
 Constructor. More...
 
const SpriteSheetgetSpriteSheet () const
 Get the spritesheet used to construct the animation. More...
 
void setRepeatCount (int count)
 Set the repetition count of the animation. More...
 
int getRepeatCount () const
 Get the number of times the animation repeats before completing. More...
 
bool isRepeating () const
 Check if the animation is repeating or not. More...
 
void setLoop (bool loop)
 Set whether or not the animation should repeat indefinitely. More...
 
bool isLooped () const
 Check if the animation is looped or not. More...
 
void setDuration (const Time &duration)
 Set the duration of the animation. More...
 
const TimegetDuration () const
 Get the duration of the animation. More...
 
void setPlaybackSpeed (float speed)
 Set the speed factor of the animation. More...
 
float getPlaybackSpeed () const
 Get the speed factor. More...
 
void setFrameRate (unsigned int frameRate)
 Set the frame rate playback of the animation. More...
 
unsigned int getFrameRate () const
 Get the animations playback frame rate. More...
 
void setDirection (Direction direction)
 Set the direction in which the animation should be played. More...
 
Direction getDirection () const
 Get the animations playing direction. More...
 
const std::string & getName () const
 Get the name of the animation. More...
 
void setStartDelay (const Time &delay, bool oneTime=false)
 Set the time to wait before that animation is started. More...
 
const TimegetStartDelay () const
 Get the time waited before the animation is played. More...
 
bool isStartDelayedOnce () const
 Check whether or not the animation is start delayed once. More...
 
bool isStartDelayed () const
 Check whether or not the animation is played after a delay. More...
 
void showTargetOnStart (bool show)
 Set whether or not the target is shown when the animation starts. More...
 
bool isTargetShownOnStart () const
 Check whether or not the target is shown when the animation starts. More...
 
void hideTargetOnCompletion (bool hide)
 Set whether or not the target is hidden when the animation completes. More...
 
bool isTargetHiddenOnCompletion () const
 Check whether or not the target is hidden when the animation completes. More...
 
void setCurrentFrameResetOnInterrupt (bool reset)
 Set whether or not the current animation frame is reset to the first frame when the animation is stopped before completing. More...
 
bool isCurrentFrameResetOnInterrupt () const
 Check if the current frame is reset or not when animation is interrupted. More...
 
void addFrames (const Index &startPos, unsigned int numOfFrames, FrameArrangement arrangement=FrameArrangement::Horizontal)
 Add frames from the spritesheet to the animation. More...
 
void addFrame (const Index &frame)
 Add an animation frame to the end of the animation. More...
 
void insertFrameAt (unsigned int index, const Index &frameIndex)
 Insert an animation frame within the current animation sequence. More...
 
AnimationFramegetFirstFrame ()
 Get the first frame of the animation. More...
 
const AnimationFramegetFirstFrame () const
 
AnimationFramegetLastFrame ()
 Get the last frame of the animation. More...
 
const AnimationFramegetLastFrame () const
 
AnimationFramegetFrameAt (unsigned int index)
 Get the frame at an index. More...
 
const AnimationFramegetFrameAt (unsigned int index) const
 
AnimationFramegetFrame (const std::string &name)
 Get the frame with a given name. More...
 
const AnimationFramegetFrame (const std::string &name) const
 
const std::vector< AnimationFrame > & getAllFrames () const
 Get all the frames in the animation. More...
 
unsigned int getFrameCount () const
 Get the total number of frames in the animation sequence. More...
 
const TimegetFrameTime () const
 Get the time spent on each frame in the animation sequence. More...
 
bool hasFrameAtIndex (unsigned int index) const
 Check if the animation has a frame at an index. More...
 
void removeFirstFrame ()
 Remove the first frame from the animation sequence. More...
 
void removeLastFrame ()
 Remove the last frame from the animation. More...
 
void removeFrameAt (unsigned int index)
 Remove an animation frame withing the animation sequence. More...
 
void removeAll ()
 Remove all of the animation frames. More...
 
void finishOnFrame (int index)
 Set the frame the animation should finish on. More...
 
void finishOnFirstFrame ()
 Set the animation to finish on the first frame. More...
 
void finishOnLastFrame ()
 Set the animation to finish on the last frame. More...
 
unsigned int getCompletionFrameIndex () const
 Get the index of the completion frame. More...
 
AnimationFramegetCurrentFrame ()
 Get the current frame. More...
 
const AnimationFramegetCurrentFrame () const
 
AnimationFramegetNextFrame ()
 Get the frame that comes after the current frame. More...
 
const AnimationFramegetNextFrame () const
 
AnimationFramegetPreviousFrame ()
 Get the frame that comes before the current frame. More...
 
const AnimationFramegetPreviousFrame () const
 
float getProgress () const
 Get the completion progress of the animation in the range [0, 1]. More...
 
void suspendedEventListener (int id, bool suspend)
 Prevent further executions of an event listener. More...
 
bool isEventListenerSuspended (int id) const
 Check if an event listener is suspended or not. More...
 
bool removeEventListener (int id)
 Remove an event listener from an event. More...
 
int onFrameSwitch (const Callback< AnimationFrame * > &callback, bool oneTime=false)
 Add a callback to a frame switch event. More...
 
int onStart (const Callback< Animation * > &callback, bool oneTime=false)
 Add an event listener to a start event. More...
 
int onPlay (const Callback< Animation * > &callback, bool oneTime=false)
 Add an event listener to a play event. More...
 
int onPause (const Callback< Animation * > &callback, bool oneTime=false)
 Add an event listener to a pause event. More...
 
int onResume (const Callback< Animation * > &callback, bool oneTime=false)
 Add an event listener to a resume event. More...
 
int onRestart (const Callback< Animation * > &callback, bool oneTime=false)
 Add an event listener to a restart event. More...
 
int onStop (const Callback< Animation * > &callback, bool oneTime=false)
 Add an event listener to a stop event. More...
 
int onRepeat (const Callback< Animation * > &callback, bool oneTime=false)
 Add an event listener to a repeat event. More...
 
int onComplete (const Callback< Animation * > &callback, bool oneTime=false)
 Add an event listener to a complete event. More...
 
void emit (const std::string &event)
 
void setCurrentFrameIndex (unsigned int index)
 

Static Public Member Functions

static Animation::Ptr create (const std::string &name, const SpriteSheet &spriteSheet, const Time &duration=Time::Zero)
 Create a new Animation object. More...
 

Detailed Description

A SpriteSheet/frame based animation.

An ime::Animation specifies how a ime::Sprite object is animated.

In order to play the animation it must be added to a ime::Animator

Definition at line 51 of file Animation.h.

Member Typedef Documentation

◆ Ptr

using ime::Animation::Ptr = std::shared_ptr<Animation>

Shared animation pointer.

Definition at line 53 of file Animation.h.

Member Enumeration Documentation

◆ Direction

enum class ime::Animation::Direction
strong

The playing direction of the animation.

Enumerator
Forward 

The animation is played forwards.

Reverse 

The animation is played in reverse.

Alternate_Forward 

The animation alternates back and forth starting in the forward direction.

Alternate_Reverse 

The animation alternates back and forth starting in the reverse direction.

Definition at line 58 of file Animation.h.

Constructor & Destructor Documentation

◆ Animation()

ime::Animation::Animation ( const std::string &  name,
const SpriteSheet spriteSheet,
const Time duration = Time::Zero 
)

Constructor.

Parameters
nameThe name of the animation
spriteSheetThe spritesheet containing the animation frames
durationThe duration of the animation before it completes or loops around

If the duration argument is unspecified (i.e left as ime::Time::Zero), then it will be derived from the frame rate. If the duration is specified then the frame rate will be overridden and derived from the given duration

See also
setFrameRate

Member Function Documentation

◆ addFrame()

void ime::Animation::addFrame ( const Index frame)

Add an animation frame to the end of the animation.

Parameters
frameIndex of the frame to be added from the spritesheet

This function allows the animation to be created from frames that are not contiguously arranged on the spritesheet. If frame is out of the spritesheet bounds, then this function has no effect

◆ addFrames()

void ime::Animation::addFrames ( const Index startPos,
unsigned int  numOfFrames,
FrameArrangement  arrangement = FrameArrangement::Horizontal 
)

Add frames from the spritesheet to the animation.

Parameters
startPosPosition of the first frame on the spritesheet
numOfFramesNumber of frames to add to the animation
arrangementHow the frames are arranged on the spritesheet
Exceptions
InvalidArgumentExceptionIf startPos or numFrames is invalid

Note that if arrangement is left unspecified, this function assumes that the animation frames are contiguously arranged horizontally on the spritesheet

Warning
The position of the first and the last frame must be within the bounds of the spritesheet

◆ create()

static Animation::Ptr ime::Animation::create ( const std::string &  name,
const SpriteSheet spriteSheet,
const Time duration = Time::Zero 
)
static

Create a new Animation object.

Parameters
nameThe name of the animation
spriteSheetThe spritesheet containing the animation frames
durationThe duration of the animation before it completes or loops around
Returns
The newly created Animation object

If the duration argument is unspecified (i.e left as ime::Time::Zero), then it will be derived from the frame rate. If the duration is specified then the frame rate will be overridden and derived from the given duration

◆ finishOnFirstFrame()

void ime::Animation::finishOnFirstFrame ( )

Set the animation to finish on the first frame.

By default, the animation finishes on the last frame

See also
finishOnLastFrame

◆ finishOnFrame()

void ime::Animation::finishOnFrame ( int  index)

Set the frame the animation should finish on.

Parameters
indexThe index of the frame the animation should finish on

Note that index will be ignored if it is higher than the number frames in the animation sequence and the default behavior will take place when the animation finishes. When set to a negative value, the animation will end on the last frame, otherwise it will end of the frame specified by index

By default, the animation finishes on the last frame

Note
If the current completion frame is not the last or the first frame then this function must be called every time a frame is removed or added from/to the sequence

◆ finishOnLastFrame()

void ime::Animation::finishOnLastFrame ( )

Set the animation to finish on the last frame.

By default, the animation finishes on the last frame

See also
finishOnFirstFrame

◆ getAllFrames()

const std::vector< AnimationFrame > & ime::Animation::getAllFrames ( ) const

Get all the frames in the animation.

Returns
All the frames in he animation

◆ getCompletionFrameIndex()

unsigned int ime::Animation::getCompletionFrameIndex ( ) const

Get the index of the completion frame.

Returns
The index of the completion frame
See also
finishOnFrame

◆ getCurrentFrame()

AnimationFrame * ime::Animation::getCurrentFrame ( )

Get the current frame.

Returns
The current frame or nullptr if the animation does not have any frames
See also
getNextFrame, getPreviousFrame

◆ getDirection()

Direction ime::Animation::getDirection ( ) const

Get the animations playing direction.

Returns
The animations playing direction
See also
setDirection

◆ getDuration()

const Time & ime::Animation::getDuration ( ) const

Get the duration of the animation.

Returns
The duration of the animation
See also
setDuration

◆ getFirstFrame()

AnimationFrame * ime::Animation::getFirstFrame ( )

Get the first frame of the animation.

Returns
The first frame of the animation or an empty value if the animation has no frames
See also
addFrame, addFrames and getLastFrame

◆ getFrame()

AnimationFrame * ime::Animation::getFrame ( const std::string &  name)

Get the frame with a given name.

Parameters
nameThe name of the frame
Returns
The frame at the specified name or nullptr if there is no such frame
See also
getFirstFrame and getLastFrame

◆ getFrameAt()

AnimationFrame * ime::Animation::getFrameAt ( unsigned int  index)

Get the frame at an index.

Parameters
indexThe index to get the frame of
Returns
The frame at the specified index or an empty value if the index is out of bounds
See also
getFirstFrame and getLastFrame

◆ getFrameCount()

unsigned int ime::Animation::getFrameCount ( ) const

Get the total number of frames in the animation sequence.

Returns
The total number of frames in the animation sequence

◆ getFrameRate()

unsigned int ime::Animation::getFrameRate ( ) const

Get the animations playback frame rate.

Returns
The animations playback frame rate
See also
setFrameRate

◆ getFrameTime()

const Time & ime::Animation::getFrameTime ( ) const

Get the time spent on each frame in the animation sequence.

Returns
The time spent on the current frame before changing to the next frame

◆ getLastFrame()

AnimationFrame * ime::Animation::getLastFrame ( )

Get the last frame of the animation.

Returns
The last frame or an empty value if the animation has no frames
See also
addFrame, addFrames and getFirstFrame

◆ getName()

const std::string & ime::Animation::getName ( ) const

Get the name of the animation.

Returns
The name of the animation

◆ getNextFrame()

AnimationFrame * ime::Animation::getNextFrame ( )

Get the frame that comes after the current frame.

Returns
The next frame or nullptr if there is no next frame
See also
getCurrentFrame, getPreviousFrame

◆ getPlaybackSpeed()

float ime::Animation::getPlaybackSpeed ( ) const

Get the speed factor.

Returns
The speed factor
See also
setPlaybackSpeed

◆ getPreviousFrame()

AnimationFrame * ime::Animation::getPreviousFrame ( )

Get the frame that comes before the current frame.

Returns
The previous frame or nullptr if there is no previous frame
See also
getCurrentFrame, getNextFrame

◆ getProgress()

float ime::Animation::getProgress ( ) const

Get the completion progress of the animation in the range [0, 1].

Returns
The completion progress

◆ getRepeatCount()

int ime::Animation::getRepeatCount ( ) const

Get the number of times the animation repeats before completing.

Returns
The number of times the animation is repeated

The returned value of this function implies the following:

-1 = The animation repeats forever and never completes 0 = The animation does not repeat x = The animation repeats x times, where x is some positive number

See also
setRepeatCount

◆ getSpriteSheet()

const SpriteSheet & ime::Animation::getSpriteSheet ( ) const

Get the spritesheet used to construct the animation.

Returns
The spritesheet used by the animation

◆ getStartDelay()

const Time & ime::Animation::getStartDelay ( ) const

Get the time waited before the animation is played.

Returns
The start delay of the animation
See also
setStartDelay

◆ hasFrameAtIndex()

bool ime::Animation::hasFrameAtIndex ( unsigned int  index) const

Check if the animation has a frame at an index.

Parameters
indexIndex to be checked
Returns
True if the animation has a frame at the given index or false if the index is out of bounds

◆ hideTargetOnCompletion()

void ime::Animation::hideTargetOnCompletion ( bool  hide)

Set whether or not the target is hidden when the animation completes.

Parameters
hideTrue to hide the target or false to leave the targets visibility state unmodified

By default the targets visibility state is unmodified. This means that if the target was shown when the animation completed, then it will remain shown and if the target was hidden, it will remain hidden

See also
showTargetOnStart

◆ insertFrameAt()

void ime::Animation::insertFrameAt ( unsigned int  index,
const Index frameIndex 
)

Insert an animation frame within the current animation sequence.

Parameters
frameIndexThe index of the frame to insert from the spritesheet
indexThe index where the frame should be inserted

If index is negative or higher than the current number of frames, then the frame will be added at the end of the sequence instead. In addition, if frameIndex is out of the spritesheet bounds, then this function has no effect

◆ isCurrentFrameResetOnInterrupt()

bool ime::Animation::isCurrentFrameResetOnInterrupt ( ) const

Check if the current frame is reset or not when animation is interrupted.

Returns
True if the frame is reset on interrupt, otherwise false
See also
setCurrentFrameResetOnInterrupt

◆ isEventListenerSuspended()

bool ime::Animation::isEventListenerSuspended ( int  id) const

Check if an event listener is suspended or not.

Parameters
idThe identification number of the listener to be checked
Returns
True if suspended, otherwise false

This function also returns false if the specified event listener does not exist

See also
suspendedEventListener

◆ isLooped()

bool ime::Animation::isLooped ( ) const

Check if the animation is looped or not.

Returns
True if the animation is looped or false if it is not looped
See also
setLoop

◆ isRepeating()

bool ime::Animation::isRepeating ( ) const

Check if the animation is repeating or not.

Returns
True if the animation repeats, otherwise false
See also
setRepeatCount and getRepeatCount

◆ isStartDelayed()

bool ime::Animation::isStartDelayed ( ) const

Check whether or not the animation is played after a delay.

Returns
True if the animation is played after a delay, or false if if is played immediately
See also
setStartDelay

◆ isStartDelayedOnce()

bool ime::Animation::isStartDelayedOnce ( ) const

Check whether or not the animation is start delayed once.

Returns
True if the animation is start delayed once, otherwise false
See also
setStartDelay

◆ isTargetHiddenOnCompletion()

bool ime::Animation::isTargetHiddenOnCompletion ( ) const

Check whether or not the target is hidden when the animation completes.

Returns
True if the target is hidden or false if the visibility state of the target is unmodified
See also
hideTargetOnCompletion

◆ isTargetShownOnStart()

bool ime::Animation::isTargetShownOnStart ( ) const

Check whether or not the target is shown when the animation starts.

Returns
True if the target is shown or false if the visibility state of the target is unmodified
See also
showTargetOnStart

◆ onComplete()

int ime::Animation::onComplete ( const Callback< Animation * > &  callback,
bool  oneTime = false 
)

Add an event listener to a complete event.

Parameters
callbackThe function to be executed when the animation completes
oneTimeTrue to execute the callback one-time or false to execute it every time the event is triggered
Returns
The event listener unique identification number

You can add as many event listeners as you like to this event

◆ onFrameSwitch()

int ime::Animation::onFrameSwitch ( const Callback< AnimationFrame * > &  callback,
bool  oneTime = false 
)

Add a callback to a frame switch event.

Parameters
callbackThe function to be called when the animations current frame changes
oneTimeTrue to execute the callback one-time or false to execute it every time the event is triggered
Returns
The event listener unique identification number

The callback is passed a pointer to the new animation frame on invocation. You can add as many event listeners as you like to this event

◆ onPause()

int ime::Animation::onPause ( const Callback< Animation * > &  callback,
bool  oneTime = false 
)

Add an event listener to a pause event.

Parameters
callbackThe function to be executed when the animation is paused
oneTimeTrue to execute the callback one-time or false to execute it every time the event is triggered
Returns
The event listener unique identification number

The callback is passed a pointer to the animation on invocation. You can add as many event listeners as you like to this event

See also
onResume

◆ onPlay()

int ime::Animation::onPlay ( const Callback< Animation * > &  callback,
bool  oneTime = false 
)

Add an event listener to a play event.

Parameters
callbackThe function to be executed when the animation starts animating
oneTimeTrue to execute the callback one-time or false to execute it every time the event is triggered
Returns
The event listener unique identification number

This event is emitted after the start delay expires. At this point the animation starts to animate. To perform an action before the start delay executes, use onStart().

The callback is passed a pointer to the animation on invocation. You can add as many event listeners as you like to this event

See also
onStart, setStartDelay

◆ onRepeat()

int ime::Animation::onRepeat ( const Callback< Animation * > &  callback,
bool  oneTime = false 
)

Add an event listener to a repeat event.

Parameters
callbackThe function to be executed when the animation is repeated
oneTimeTrue to execute the callback one-time or false to execute it every time the event is triggered
Returns
The event listener unique identification number

You can add as many event listeners as you like to this event

◆ onRestart()

int ime::Animation::onRestart ( const Callback< Animation * > &  callback,
bool  oneTime = false 
)

Add an event listener to a restart event.

Parameters
callbackThe function to be executed when the animation is restarted
oneTimeTrue to execute the callback one-time or false to execute it every time the event is triggered
Returns
The event listener unique identification number

The callback is passed a pointer to the animation on invocation. You can add as many event listeners as you like to this event

See also
onPlay

◆ onResume()

int ime::Animation::onResume ( const Callback< Animation * > &  callback,
bool  oneTime = false 
)

Add an event listener to a resume event.

Parameters
callbackThe function to be executed when the animation is resumed from a paused state
oneTimeTrue to execute the callback one-time or false to execute it every time the event is triggered
Returns
The event listener unique identification number

The callback is passed a pointer to the animation on invocation. You can add as many event listeners as you like to this event

See also
onPause

◆ onStart()

int ime::Animation::onStart ( const Callback< Animation * > &  callback,
bool  oneTime = false 
)

Add an event listener to a start event.

Parameters
callbackThe function to be executed when the animation starts
oneTimeTrue to execute the callback one-time or false to execute it every time the event is triggered
Returns
The event listener unique identification number

This event is emitted before the start delay timer executes. To perform an action after the start delay timer expires, use onPlay().

The callback is passed a pointer to the animation on invocation. You can add as many event listeners as you like to this event

See also
onPlay, setStartDelay

◆ onStop()

int ime::Animation::onStop ( const Callback< Animation * > &  callback,
bool  oneTime = false 
)

Add an event listener to a stop event.

Parameters
callbackThe function to be executed when the animation is stopped from a playing or paused state
oneTimeTrue to execute the callback one-time or false to execute it every time the event is triggered
Returns
The event listener unique identification number

The callback is passed a pointer to the animation on invocation. You can add as many event listeners as you like to this event

See also
onPlay, onPause, onResume

◆ removeAll()

void ime::Animation::removeAll ( )

Remove all of the animation frames.

◆ removeEventListener()

bool ime::Animation::removeEventListener ( int  id)

Remove an event listener from an event.

Parameters
idThe unique identification number of the event listener
Returns
True if the event listener was removed or false if no such event listener exists

◆ removeFirstFrame()

void ime::Animation::removeFirstFrame ( )

Remove the first frame from the animation sequence.

The function has no effect if the animation has no frames

See also
removeLastFrame

◆ removeFrameAt()

void ime::Animation::removeFrameAt ( unsigned int  index)

Remove an animation frame withing the animation sequence.

Parameters
indexThe index of the animation frame to be removed

The function has no effect if the animation has no frames

See also
removeFirstFrame, removeLastFrame

◆ removeLastFrame()

void ime::Animation::removeLastFrame ( )

Remove the last frame from the animation.

The function has no effect if the animation has no frames

See also
removeFirstFrame

◆ setCurrentFrameResetOnInterrupt()

void ime::Animation::setCurrentFrameResetOnInterrupt ( bool  reset)

Set whether or not the current animation frame is reset to the first frame when the animation is stopped before completing.

Parameters
resetTrue to reset the frame or false to leave it as is

By default, the current frame is reset to the first frame

See also
isCurrentFrameResetOnInterrupt

◆ setDirection()

void ime::Animation::setDirection ( Direction  direction)

Set the direction in which the animation should be played.

Parameters
directionThe animations direction of play

By default the direction of play is ime::Animation::Direction::Forward

See also
getDirection

◆ setDuration()

void ime::Animation::setDuration ( const Time duration)

Set the duration of the animation.

Parameters
durationThe new duration of the animation

By default, the duration is determined by the frame rate. When the duration is explicitly set, the frame rate is overridden and derived from the given duration. Therefore you only need to set either the frame rate or the duration

Note that if the specified duration is less than or equal to ime::Time::Zero, then the duration will be set to the default one. In addition, if the specified duration results in a frame time of more than 1 second, the frame rate will be set to zero.

See also
getDuration, setFrameRate and getFrameTime

◆ setFrameRate()

void ime::Animation::setFrameRate ( unsigned int  frameRate)

Set the frame rate playback of the animation.

Parameters
frameRateThe frame rate to be set

When the frame rate is explicitly set, the duration of the animation is overridden and derived from the given frame rate. Therefore you only need to set either the duration or the frame rate. In addition. you should note that if the frame rate is less than or equal to zero then it will be set to the default frame rate

By default, the frame rate is 24 frames per second

See also
setDuration, getFrameRate

◆ setLoop()

void ime::Animation::setLoop ( bool  loop)

Set whether or not the animation should repeat indefinitely.

Parameters
loopTrue to loop animation, otherwise false

This function is a simplification of setRepeatCount(). When the loop argument is true, the repeat count will be set to -1 and when it is false, the repeat count will be set to zero

See also
setRepeatCount, isLooped

◆ setPlaybackSpeed()

void ime::Animation::setPlaybackSpeed ( float  speed)

Set the speed factor of the animation.

Parameters
speedThe new speed factor

The speed factor controls the playback speed of the animation. For example, a speed of 2.0f will make the animation play at 2x its normal speed, a speed of 0.5f will make the animation play at half its normal speed and a speed of 0.0f will freeze the animation in time.

Note that a negative or zero playback speed value will be ignored

By default the speed is 1.0f (normal speed)

See also
getPlaybackSpeed

◆ setRepeatCount()

void ime::Animation::setRepeatCount ( int  count)

Set the repetition count of the animation.

Parameters
countThe number of times to repeat the animation

Set count to '-1' to repeat the animation forever or set it to some positive number x, where x is the number of times to repeat the animation before it completes or set it to '0' to disable repetition if the animation is currently repeating.

Note that if count is set to a negative value that is not '-1', then the repeat count will be set to '0', meaning that the animation will not repeat

By default, the animation does not repeat

See also
setLoop

◆ setStartDelay()

void ime::Animation::setStartDelay ( const Time delay,
bool  oneTime = false 
)

Set the time to wait before that animation is started.

Parameters
delayThe time to wait before the animation is played
oneTimeTrue to apply the start delay only when the animation is played for the first time or false (default) to apply the start delay every time the animation starts from the beginning

Note that oneTime parameter only applies if the animation is repeating (see setRepeat()). For non-repeating animations, the start delay will always be applied if it's set

By default, the animation plays immediately

See also
getStartDelay

◆ showTargetOnStart()

void ime::Animation::showTargetOnStart ( bool  show)

Set whether or not the target is shown when the animation starts.

Parameters
showTrue to show the target or false to leave the targets visibility state unmodified

By default, the target is shown when the animation starts. This means that if the target was hidden prior (explicitly, or via an animation finish event) then its visible property will be set to true when the animation starts playing

See also
hideTargetOnCompletion

◆ suspendedEventListener()

void ime::Animation::suspendedEventListener ( int  id,
bool  suspend 
)

Prevent further executions of an event listener.

Parameters
idThe event listeners unique identification number
suspendTrue to suspend or false to unsuspend

When suspended an event listener will be ignored when the event its listening to is fired. Execution will resume once it is unsuspended

See also
isEventListenerSuspended

The documentation for this class was generated from the following file: