Class CCAnimation

#include <Geode/cocos/sprite_nodes/CCAnimation.h>
classCCAnimation:publiccocos2d::CCObject{ ... }

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]];

Examples0
Public static methods4
staticcocos2d::CCAnimation*create()

Since v0.99.5

Creates an animation

staticcocos2d::CCAnimation*createWithSpriteFrames(
cocos2d::CCArray*arrayOfSpriteFrameNames
,
floatdelay
)
No description provided
staticcocos2d::CCAnimation*create(
cocos2d::CCArray*arrayOfAnimationFrameNames
,
floatdelayPerUnit
,
uintloops
)
No description provided
staticcocos2d::CCAnimation*create(
cocos2d::CCArray*arrayOfAnimationFrameNames
,
floatdelayPerUnit
)
No description provided
Public member functions17
voidaddSpriteFrame()

Adds a CCSpriteFrame to a CCAnimation. The frame will be added with one “delay unit”.

voidaddSpriteFrameWithFileName(
charconst*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.

voidaddSpriteFrameWithTexture(,)

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.

boolinit()
No description provided
boolinitWithSpriteFrames(,
floatdelay
)

Since v0.99.5

Initializes a CCAnimation with frames and a delay between frames

boolinitWithAnimationFrames(
cocos2d::CCArray*arrayOfAnimationFrames
,
floatdelayPerUnit
,
uintloops
)

Since v2.0

Initializes a CCAnimation with CCAnimationFrame

virtualcocos2d::CCObject*copyWithZone()
No description provided
virtualfloatgetTotalDelayUnits()const

total Delay units of the CCAnimation.

virtualfloatgetDelayPerUnit()const

Delay in seconds of the “delay unit”

virtualvoidsetDelayPerUnit()

Delay in seconds of the “delay unit”

virtualfloatgetDuration()

duration in seconds of the whole animation. It is the result of totalDelayUnits * delayPerUnit

virtualcocos2d::CCArray*getFrames()const

array of CCAnimationFrames

virtualvoidsetFrames()

array of CCAnimationFrames

virtualboolgetRestoreOriginalFrame()const

whether or not it shall restore the original frame when the animation finishes

virtualvoidsetRestoreOriginalFrame(
boolvar
)

whether or not it shall restore the original frame when the animation finishes

virtualuintgetLoops()const

how many times the animation is going to loop. 0 means animation is not animated. 1, animation is executed one time, …

virtualvoidsetLoops(
uintvar
)

how many times the animation is going to loop. 0 means animation is not animated. 1, animation is executed one time, …

Fields0
Protected member functions0
Protected fields5
floatm_fTotalDelayUnits
;

total Delay units of the CCAnimation.

floatm_fDelayPerUnit
;

Delay in seconds of the “delay unit”

floatm_fDuration
;

duration in seconds of the whole animation. It is the result of totalDelayUnits * delayPerUnit

boolm_bRestoreOriginalFrame
;

whether or not it shall restore the original frame when the animation finishes

uintm_uLoops
;

how many times the animation is going to loop. 0 means animation is not animated. 1, animation is executed one time, …