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]];
Class CCAnimation
#include <Geode/cocos/sprite_nodes/CCAnimation.h>
Examples0
Public static methods4
staticcocos2d::CCAnimation*create()
Creates an animation
staticcocos2d::CCAnimation*createWithSpriteFrames(cocos2d::CCArray*arrayOfSpriteFrameNames,floatdelay)
staticcocos2d::CCAnimation*create(cocos2d::CCArray*arrayOfAnimationFrameNames,floatdelayPerUnit,uintloops)
staticcocos2d::CCAnimation*create(cocos2d::CCArray*arrayOfAnimationFrameNames,floatdelayPerUnit)
Public member functions17
voidaddSpriteFrame(cocos2d::CCSpriteFrame*pFrame)
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(cocos2d::CCTexture2D*pobTexture,)
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()
boolinitWithSpriteFrames(cocos2d::CCArray*pFrames,floatdelay)
Initializes a CCAnimation with frames and a delay between frames
boolinitWithAnimationFrames(cocos2d::CCArray*arrayOfAnimationFrames,floatdelayPerUnit,uintloops)
Initializes a CCAnimation with CCAnimationFrame
virtualcocos2d::CCObject*copyWithZone(cocos2d::CCZone*pZone)
virtualfloatgetTotalDelayUnits()const
total Delay units of the CCAnimation.
virtualfloatgetDelayPerUnit()const
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, …
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, …