A CCAnimation object is used to perform animations on the CCSprite objects. More...
#include <CCAnimation.h>
Public Member Functions | |
CCAnimation () | |
~CCAnimation (void) | |
void | addSpriteFrame (CCSpriteFrame *pFrame) |
Adds a CCSpriteFrame to a CCAnimation. More... | |
void | addSpriteFrameWithFileName (const char *pszFileName) |
Adds a frame with an image filename. More... | |
void | addSpriteFrameWithTexture (CCTexture2D *pobTexture, const CCRect &rect) |
Adds a frame with a texture and a rect. More... | |
bool | init () |
bool | initWithSpriteFrames (CCArray *pFrames, float delay=0.0f) |
Initializes a CCAnimation with frames and a delay between frames. More... | |
bool | initWithAnimationFrames (CCArray *arrayOfAnimationFrames, float delayPerUnit, unsigned int loops) |
Initializes a CCAnimation with CCAnimationFrame. More... | |
virtual CCObject * | copyWithZone (CCZone *pZone) |
virtual float | getTotalDelayUnits (void) |
getTotalDelayUnits More... | |
virtual float | getDuration (void) |
getDuration More... | |
virtual CCArray * | getFrames (void) |
getFrames More... | |
virtual void | setFrames (CCArray *var) |
setFrames More... | |
Public Member Functions inherited from CCObject | |
CCObject (void) | |
virtual | ~CCObject (void) |
void | release (void) |
void | retain (void) |
CCObject * | autorelease (void) |
CCObject * | copy (void) |
bool | isSingleReference (void) const |
unsigned int | retainCount (void) const |
virtual bool | isEqual (const CCObject *pObject) |
virtual void | acceptVisitor (CCDataVisitor &visitor) |
virtual void | update (float dt) |
Static Public Member Functions | |
static CCAnimation * | create (void) |
Creates an animation. More... | |
static CCAnimation * | createWithSpriteFrames (CCArray *arrayOfSpriteFrameNames, float delay=0.0f) |
static CCAnimation * | create (CCArray *arrayOfAnimationFrameNames, float delayPerUnit, unsigned int loops) |
static CCAnimation * | create (CCArray *arrayOfAnimationFrameNames, float delayPerUnit) |
Protected Attributes | |
float | m_fTotalDelayUnits |
total Delay units of the CCAnimation. More... | |
float | m_fDelayPerUnit |
Delay in seconds of the "delay unit". More... | |
float | m_fDuration |
getDelayPerUnit More... | |
CCArray * | m_pFrames |
array of CCAnimationFrames More... | |
bool | m_bRestoreOriginalFrame |
whether or not it shall restore the original frame when the animation finishes More... | |
unsigned int | m_uLoops |
getRestoreOriginalFrame More... | |
Protected Attributes inherited from CCObject | |
unsigned int | m_uReference |
unsigned int | m_uAutoReleaseCount |
Additional Inherited Members | |
Public Attributes inherited from CCObject | |
unsigned int | m_uID |
int | m_nLuaID |
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 | ( | void | ) |
void addSpriteFrame | ( | CCSpriteFrame * | pFrame) |
Adds a CCSpriteFrame to a CCAnimation.
The frame will be added with one "delay unit".
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.
void addSpriteFrameWithTexture | ( | CCTexture2D * | pobTexture, |
const CCRect & | rect | ||
) |
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.
|
static |
Creates an animation.
|
static |
|
inlinestatic |
|
static |
|
virtual |
getDuration
|
virtual |
getFrames
|
virtual |
getTotalDelayUnits
bool init | ( | ) |
bool initWithAnimationFrames | ( | CCArray * | arrayOfAnimationFrames, |
float | delayPerUnit, | ||
unsigned int | loops | ||
) |
Initializes a CCAnimation with CCAnimationFrame.
bool initWithSpriteFrames | ( | CCArray * | pFrames, |
float | delay = 0.0f |
||
) |
Initializes a CCAnimation with frames and a delay between frames.
|
virtual |
setFrames
|
protected |
whether or not it shall restore the original frame when the animation finishes
|
protected |
Delay in seconds of the "delay unit".
|
protected |
getDelayPerUnit
setDelayPerUnit duration in seconds of the whole animation. It is the result of totalDelayUnits * delayPerUnit
|
protected |
total Delay units of the CCAnimation.
|
protected |
array of CCAnimationFrames
|
protected |
getRestoreOriginalFrame
setRestoreOriginalFrame how many times the animation is going to loop. 0 means animation is not animated. 1, animation is executed one time, ...