v2.0.2
Instance Methods | Class Methods | Properties | List of all members
CC3NodeAnimation Class Reference

#import <CC3NodeAnimation.h>

Inheritance diagram for CC3NodeAnimation:
Inheritance graph
[legend]

Instance Methods

(void) - establishFrameAt:forNode:
 
(void) - establishFrameAt:inNodeAnimationState:
 
(id) - initWithFrameCount:
 
(CCTime) - timeAtFrame:
 

Class Methods

(id) + animationWithFrameCount:
 
(CCTime) + interpolationEpsilon
 
(void) + setInterpolationEpsilon:
 

Properties

GLuint frameCount
 
BOOL hasVariableFrameTiming
 
BOOL isAnimating
 
BOOL isAnimatingLocation
 
BOOL isAnimatingQuaternion
 
BOOL isAnimatingScale
 
BOOL shouldInterpolate
 

Detailed Description

A CC3NodeAnimation manages the animation of a node.

An instance is held in the animation property of the node itself, and the node delegates to its CC3NodeAnimation when the establishAnimationFrameAt: method is invoked on the node.

Animations define animated content in in a series of frames (often called key-frames), and can be configured to interpolate the animated state between these frames if necessary, ensuring smooth animation, regardless of how many, or how widely spaced, the frames of actual animated content are.

A single CC3NodeAnimation instance can be shared by multiple nodes. This is a typical situation when creating many copies of a node that is animated.

CC3NodeAnimation is an abstract class. Subclasses define concrete animation data storage.

Method Documentation

+ (id) animationWithFrameCount: (GLuint)  numFrames

Allocates and initializes an autoreleased instance to animate with the specified number of animation frames.

- (void) establishFrameAt: (CCTime)  t
forNode: (CC3Node *)  __deprecated 
Deprecated:
Use establishFrameAt:inNodeAnimationState: instead.
- (void) establishFrameAt: (CCTime)  t
inNodeAnimationState: (CC3NodeAnimationState *)  animState 

Updates the location, quaternion, and scale of the specified animation state based on the animation frame located at the specified time, which should be a value between zero and one, with zero indicating the first animation frame, and one indicating the last animation frame.

Only those properties of the animation state for which there is animation data will be changed. If the shouldInterpolate property is set to YES, linear interpolation of the frame data is performed, based on the frameCount and the specified time.

- (id) initWithFrameCount: (GLuint)  numFrames

Initializes this instance to animate with the specified number of animation frames.

+ (CCTime) interpolationEpsilon

Indicates a fractional value of a frame below which interpolation will not be performed.

If an animation time is within this fraction above or below an exact frame time (relative to the previous or next frame), the frame time itself is used, instead of interpolating between that frame time and the next or previous frame time. This allows the animation to avoid an interpolation calculation if the difference will be unnoticable when compared to simply using the values for that specific frame.

This value is specified as a fraction of a frame (between zero and one). The initial value is set at 0.1, indicating that no interpolation will be performed if the animation time is within 10% of the duration between the frame and the frame before or after it.

Setting the value of this property to zero will cause interpolation to always be performed, and setting the value to one will cause interpolation to never be performed.

The value of this class-side property affects all animation.

+ (void) setInterpolationEpsilon: (CCTime)  epsilon

Indicates a fractional value of a frame below which interpolation will not be performed.

If an animation time is within this fraction above or below an exact frame time (relative to the previous or next frame), the frame time itself is used, instead of interpolating between that frame time and the next or previous frame time. This allows the animation to avoid an interpolation calculation if the difference will be unnoticable when compared to simply using the values for that specific frame.

This value is specified as a fraction of a frame (between zero and one). The initial value is set at 0.1, indicating that no interpolation will be performed if the animation time is within 10% of the duration between the frame and the frame before or after it.

Setting the value of this property to zero will cause interpolation to always be performed, and setting the value to one will cause interpolation to never be performed.

The value of this class-side property affects all animation.

- (CCTime) timeAtFrame: (GLuint)  frameIndex

Returns the time at which the frame at the specified index occurs.

The returned time value will be between zero and one, where zero represents the time of the first frame and one represents the time of the last frame.

This base implementation assumes a constant time between each frame and the next, so the returned value is calculated as (frameIndex / (frameCount - 1)), which is then clamped to the range between zero and one. Subclasses that allow variable times between frames will override to return the appropriate value.

Property Documentation

- (GLuint) frameCount
readnonatomicassign

The number of frames of animated content.

This property indicates the number of frames for which animated content is available (often called key-frames). Because animations can be configured to interpolate between frames, it is quite common for the effective number of animated frames to be substantially higher than the number of frames of available animated content.

As an extreme example, this property might indicate only two frames of animated content (a beginning and end state). If that animation played out over 10 seconds, it would interpolate several hundred "tween-frames", creating a smooth transition from the beginning to end state. More commonly, animations will specify a number of frames of content, to ensure sophisticated and realistic animation.

- (BOOL) hasVariableFrameTiming
readnonatomicassign

Indicates whether the time interval between frames can vary from frame to frame, or whether the time interval between frames is constant across all frames.

If this property returns NO, the frames of this animation are equally spaced in time.

- (BOOL) isAnimating
readnonatomicassign

Indicates whether animation is enabled and any animated content (location, quaternion, or scale) is available and enabled.

- (BOOL) isAnimatingLocation
readnonatomicassign

Indicates whether location animated content is available and is enabled.

- (BOOL) isAnimatingQuaternion
readnonatomicassign

Indicates whether rotation quaternion animated content is available and is enabled.

- (BOOL) isAnimatingScale
readnonatomicassign

Indicates whether scale animated content is available and is enabled.

- (BOOL) shouldInterpolate
readwritenonatomicassign

Indicates whether this animation should interpolate between frames, to ensure smooth transitions between frame content.

The initial value of this property is YES.


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