cocos2d for iPhone  2.1.0
2D game engine for iOS and OS X
 All Classes Files Functions Variables Typedefs Enumerations Enumerator Properties Macros Pages
Instance Methods | Class Methods | Properties | List of all members
CCAnimation Class Reference

#import <CCAnimation.h>

Inherits <NSObject>, and <NSCopying>.

Instance Methods

(id) - initWithSpriteFrames:
 
(id) - initWithSpriteFrames:delay:
 
(void) - addSpriteFrame:
 
(void) - addSpriteFrameWithFilename:
 
(void) - addSpriteFrameWithTexture:rect:
 

Class Methods

(id) + animation
 
(id) + animationWithSpriteFrames:
 

Properties

float totalDelayUnits
 
float delayPerUnit
 
float duration
 
NSMutableArray * frames
 
BOOL restoreOriginalFrame
 
NSUInteger loops
 

Detailed Description

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

Definition at line 72 of file CCAnimation.h.

Method Documentation

- (void) addSpriteFrame: (CCSpriteFrame *)  frame

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

- (void) addSpriteFrameWithFilename: (NSString *)  filename

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 *)  texture
rect: (CGRect)  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.

+ (id) animation

Creates an animation

Since
v0.99.5
+ (id) animationWithSpriteFrames: (NSArray *)  arrayOfSpriteFrameNames

Creates an animation with an array of CCSpriteFrame. The frames will be created with one "delay unit".

Since
v0.99.5
- (id) initWithSpriteFrames: (NSArray *)  arrayOfSpriteFrameNames

Initializes a CCAnimation with an array of CCSpriteFrame. The frames will be added with one "delay unit".

Since
v0.99.5
- (id) initWithSpriteFrames: (NSArray *)  arrayOfSpriteFrameNames
delay: (float)  delay 

Initializes a CCAnimation with an array of CCSpriteFrames and a delay between frames in seconds. The frames will be added with one "delay unit".

Since
v0.99.5

Property Documentation

- (float) delayPerUnit
readwritenonatomicassign

Delay in seconds of the "delay unit"

Definition at line 85 of file CCAnimation.h.

- (float) duration
readnonatomicassign

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

Definition at line 87 of file CCAnimation.h.

- (NSMutableArray*) frames
readwritenonatomicretain

array of CCAnimationFrames

Definition at line 89 of file CCAnimation.h.

- (NSUInteger) loops
readwritenonatomicassign

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

Definition at line 93 of file CCAnimation.h.

- (BOOL) restoreOriginalFrame
readwritenonatomicassign

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

Definition at line 91 of file CCAnimation.h.

- (float) totalDelayUnits
readnonatomicassign

total Delay units of the CCAnimation.

Definition at line 83 of file CCAnimation.h.


The documentation for this class was generated from the following file: