A Animation object is used to perform animations on the Sprite objects.
More...
#include <Animation.h>
Inherits Object, and Clonable.
|
unsigned int | _ID |
| object id, ScriptSupport need public _ID
|
|
int | _luaID |
| Lua reference id.
|
|
A Animation object is used to perform animations on the Sprite objects.
The Animation object contains AnimationFrame objects, and a possible delay between the frames. You can animate a Animation object by using the Animate action. Example:
static Animate * create(Animation *animation)
Creates the action with an Animation and will restore the original frame when the animation is over.
◆ create()
Creates an animation.
- Since
- v0.99.5
◆ addSpriteFrame()
◆ addSpriteFrameWithFile()
void addSpriteFrameWithFile |
( |
std::string_view | filename | ) |
|
Adds a frame with an image filename.
Internally it will create a SpriteFrame and it will add it. The frame will be added with one "delay unit". Added to facilitate the migration from v0.8 to v0.9.
- Parameters
-
◆ addSpriteFrameWithTexture()
void addSpriteFrameWithTexture |
( |
Texture2D * | pobTexture, |
|
|
const Rect & | rect ) |
Adds a frame with a texture and a rect.
Internally it will create a SpriteFrame and it will add it. The frame will be added with one "delay unit". Added to facilitate the migration from v0.8 to v0.9.
- Parameters
-
pobTexture | A frame with a texture. |
rect | The Texture of rect. |
◆ getTotalDelayUnits()
float getTotalDelayUnits |
( |
| ) |
const |
|
inline |
Gets the total Delay units of the Animation.
- Returns
- The total Delay units of the Animation.
◆ setDelayPerUnit()
void setDelayPerUnit |
( |
float | delayPerUnit | ) |
|
|
inline |
Sets the delay in seconds of the "delay unit".
- Parameters
-
delayPerUnit | The delay in seconds of the "delay unit". |
◆ getDelayPerUnit()
float getDelayPerUnit |
( |
| ) |
const |
|
inline |
Gets the delay in seconds of the "delay unit".
- Returns
- The delay in seconds of the "delay unit".
◆ getDuration()
float getDuration |
( |
| ) |
const |
Gets the duration in seconds of the whole animation.
It is the result of totalDelayUnits * delayPerUnit.
- Returns
- Result of totalDelayUnits * delayPerUnit.
◆ getFrames()
Gets the array of AnimationFrames.
- Returns
- The array of AnimationFrames.
◆ setFrames()
Sets the array of AnimationFrames.
- Parameters
-
frames | The array of AnimationFrames. |
◆ getRestoreOriginalFrame()
bool getRestoreOriginalFrame |
( |
| ) |
const |
|
inline |
Checks whether to restore the original frame when animation finishes.
- Returns
- Restore the original frame when animation finishes.
◆ setRestoreOriginalFrame()
void setRestoreOriginalFrame |
( |
bool | restoreOriginalFrame | ) |
|
|
inline |
Sets whether to restore the original frame when animation finishes.
- Parameters
-
restoreOriginalFrame | Whether to restore the original frame when animation finishes. |
◆ getLoops()
unsigned int getLoops |
( |
| ) |
const |
|
inline |
Gets the times the animation is going to loop.
0 means animation is not animated. 1, animation is executed one time, ...
- Returns
- The times the animation is going to loop.
◆ setLoops()
void setLoops |
( |
unsigned int | loops | ) |
|
|
inline |
Sets the times the animation is going to loop.
0 means animation is not animated. 1, animation is executed one time, ...
- Parameters
-
loops | The times the animation is going to loop. |
◆ initWithSpriteFrames()
bool initWithSpriteFrames |
( |
const Vector< SpriteFrame * > & | arrayOfSpriteFrameNames, |
|
|
float | delay = 0.0f, |
|
|
unsigned int | loops = 1 ) |
Initializes a Animation with frames and a delay between frames.
- Since
- v0.99.5
◆ initWithAnimationFrames()
bool initWithAnimationFrames |
( |
const Vector< AnimationFrame * > & | arrayOfAnimationFrameNames, |
|
|
float | delayPerUnit, |
|
|
unsigned int | loops ) |
The documentation for this class was generated from the following file: