A CCAnimation object is used to perform animations on the CCSprite objects.
More...
#include <CCAnimation.h>
A CCAnimation object is used to perform animations on the CCSprite objects.
The CCAnimation object contains CCAnimationFrame objects, and a possible delay between the frames. You can animate a CCAnimation object by using the CCAnimate action. Example:
[sprite runAction:[CCAnimate actionWithAnimation:animation]];
◆ CCAnimation()
◆ ~CCAnimation()
◆ addSpriteFrame()
◆ addSpriteFrameWithFileName()
void addSpriteFrameWithFileName |
( |
const char * |
pszFileName | ) |
|
Adds a frame with an image filename.
Internally it will create a CCSpriteFrame 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. addSpriteFrameWithFile
◆ addSpriteFrameWithTexture()
Adds a frame with a texture and a rect.
Internally it will create a CCSpriteFrame 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.
◆ copyWithZone()
◆ create() [1/3]
◆ create() [2/3]
static CCAnimation * create |
( |
CCArray * |
arrayOfAnimationFrameNames, |
|
|
float |
delayPerUnit, |
|
|
unsigned int |
loops |
|
) |
| |
|
static |
◆ create() [3/3]
Creates an animation.
- Since
- v0.99.5
◆ createWithSpriteFrames()
static CCAnimation * createWithSpriteFrames |
( |
CCArray * |
arrayOfSpriteFrameNames, |
|
|
float |
delay = 0.0f |
|
) |
| |
|
static |
◆ getDelayPerUnit()
virtual float getDelayPerUnit |
( |
void |
| ) |
|
|
virtual |
◆ getDuration()
virtual float getDuration |
( |
void |
| ) |
|
|
virtual |
◆ getFrames()
virtual CCArray * getFrames |
( |
void |
| ) |
|
|
virtual |
◆ getLoops()
virtual unsigned int getLoops |
( |
void |
| ) |
|
|
virtual |
◆ getRestoreOriginalFrame()
virtual bool getRestoreOriginalFrame |
( |
void |
| ) |
|
|
virtual |
◆ getTotalDelayUnits()
virtual float getTotalDelayUnits |
( |
void |
| ) |
|
|
virtual |
◆ init()
◆ initWithAnimationFrames()
bool initWithAnimationFrames |
( |
CCArray * |
arrayOfAnimationFrames, |
|
|
float |
delayPerUnit, |
|
|
unsigned int |
loops |
|
) |
| |
◆ initWithSpriteFrames()
bool initWithSpriteFrames |
( |
CCArray * |
pFrames, |
|
|
float |
delay = 0.0f |
|
) |
| |
Initializes a CCAnimation with frames and a delay between frames.
- Since
- v0.99.5 NA
◆ setDelayPerUnit()
virtual void setDelayPerUnit |
( |
float |
var | ) |
|
|
virtual |
◆ setFrames()
virtual void setFrames |
( |
CCArray * |
var | ) |
|
|
virtual |
◆ setLoops()
virtual void setLoops |
( |
unsigned int |
var | ) |
|
|
virtual |
◆ setRestoreOriginalFrame()
virtual void setRestoreOriginalFrame |
( |
bool |
var | ) |
|
|
virtual |
◆ m_bRestoreOriginalFrame
bool m_bRestoreOriginalFrame |
|
protected |
whether or not it shall restore the original frame when the animation finishes
◆ m_fDelayPerUnit
Delay in seconds of the "delay unit".
◆ m_fDuration
duration in seconds of the whole animation.
It is the result of totalDelayUnits * delayPerUnit
◆ m_fTotalDelayUnits
◆ m_pFrames
array of CCAnimationFrames
◆ m_uLoops
how many times the animation is going to loop.
0 means animation is not animated. 1, animation is executed one time, ...
The documentation for this class was generated from the following file:
- /home/runner/work/cocos-headers/cocos-headers/cocos2dx/sprite_nodes/CCAnimation.h