cocos2d-iphone  2.1
Improved Cocos2D API Reference (iOS version) for www.kobold2d.com developers
 All Classes Files Functions Variables Typedefs Enumerations Enumerator Properties Defines
CCAnimation Class Reference

#import <CCAnimation.h>

List of all members.

Public Member Functions

(id) - initWithSpriteFrames:
(id) - initWithSpriteFrames:delay:
(id) - initWithAnimationFrames:delayPerUnit:loops:
(void) - addSpriteFrame:
(void) - addSpriteFrameWithFilename:
(void) - addSpriteFrameWithTexture:rect:
(id) - initWithFrames:
(id) - initWithFrames:delay:
(void) - addFrame:
(void) - addFrameWithFilename:
(void) - addFrameWithTexture:rect:

Static Public Member Functions

(id) + animation
(id) + animationWithSpriteFrames:
(id) + animationWithSpriteFrames:delay:
(id) + animationWithAnimationFrames:delayPerUnit:loops:
(id) + animationWithFrames:
(id) + animationWithFrames:delay:

Protected Attributes

NSMutableArray * _frames
float _totalDelayUnits
float _delayPerUnit
BOOL _restoreOriginalFrame
NSUInteger _loops

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


Member Function 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 [read, write, assign]

Delay in seconds of the "delay unit"

- (float) duration [read, assign]

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

- (NSMutableArray*) frames [read, write, retain]

array of CCAnimationFrames

- (NSUInteger) loops [read, write, assign]

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

- (BOOL) restoreOriginalFrame [read, write, assign]

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

- (float) totalDelayUnits [read, assign]

total Delay units of the CCAnimation.


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