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

#import <CC3NodeAnimation.h>

Inheritance diagram for CC3NodeAnimationState:
Inheritance graph
[legend]

Instance Methods

(NSString *) - describeCurrentState
 
(NSString *) - describeStateForFrames:
 
(NSString *) - describeStateForFrames:fromTime:toTime:
 
(void) - disable
 
(void) - enable
 
(void) - establishFrameAt:
 
(id) - initWithAnimation:onTrack:forNode:
 

Class Methods

(id) + animationStateWithAnimation:onTrack:forNode:
 
(GLuint) + generateTrackID
 

Properties

CC3NodeAnimationanimation
 
CCTime animationTime
 
GLfloat blendingWeight
 
GLuint frameCount
 
BOOL hasVariableFrameTiming
 
BOOL isAnimating
 
BOOL isAnimatingLocation
 
BOOL isAnimatingQuaternion
 
BOOL isAnimatingScale
 
BOOL isEnabled
 
BOOL isLocationAnimationEnabled
 
BOOL isQuaternionAnimationEnabled
 
BOOL isScaleAnimationEnabled
 
CC3Vector location
 
CC3Nodenode
 
CC3Quaternion quaternion
 
CC3Vector scale
 
GLuint trackID
 

Detailed Description

CC3NodeAnimationState holds the state associated with the animation of a single node on a single track.

Each node can participate in multiple tracks of animation, and during animation, these tracks can be mixed to perform sophisticated animation blending techniques.

Each instance of this class bridges a single CC3Node with an CC3NodeAnimation running on on a particular track, and keeps track of the animation state on behalf of the node.

Method Documentation

+ (id) animationStateWithAnimation: (CC3NodeAnimation *)  animation
onTrack: (GLuint)  trackID
forNode: (CC3Node *)  node 

Allocates and initializes an autoreleased instance tracking the animation state for the specified animation running on the specified track for the specified node.

Returns nil if either the animation or the node are nil.

- (NSString*) describeCurrentState

Returns a description of the current state, including time and animated location, quaternion and scale.

- (NSString*) describeStateForFrames: (GLuint)  frameCount

Returns a description of the state at each of frameCount frames over the entire animation.

- (NSString*) describeStateForFrames: (GLuint)  frameCount
fromTime: (CCTime)  startTime
toTime: (CCTime)  endTime 

Returns a description of the state at each of frameCount frames between the specified start and end times, which should each be in the range between zero and one.

- (void) disable

Sets the isEnabled property to NO.

- (void) enable

Sets the isEnabled property to YES.

- (void) establishFrameAt: (CCTime)  t

Updates the currentFrame, location, quaternion, and scale of this instance based on the animation content found in the contained animation 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.

+ (GLuint) generateTrackID

Returns the next available trackID value.

The value returned is guaranteed to be different each time this method is invoked.

When using multi-track animation in a node assembly, the trackID identifies a particular animation track within that node assembly. Since any particular track may only affect a few nodes within the entire node assembly, when adding a new animation track to the node assembly, it can be difficult to know how to select a track ID that will not conflict with any existing tracks within that node assembly. This method can be used to generate a unique track ID to use when adding a new track of animation to a node assembly.

- (id) initWithAnimation: (CC3NodeAnimation *)  animation
onTrack: (GLuint)  trackID
forNode: (CC3Node *)  node 

Initializes this instance tracking the animation state for the specified animation running on the specified track for the specified node.

Returns nil if either the animation or the node are nil.

Property Documentation

- (CC3NodeAnimation*) animation
readnonatomicstrong

The animation whose state is being tracked by this instance.

- (CCTime) animationTime
readnonatomicassign

Returns the current animation time.

This is the value submitted to the most recent invocation of the establishFrameAt: method, or zero if that method has not yet been invoked.

- (GLfloat) blendingWeight
readwritenonatomicassign

The relative weight to use when blending this animation track with the other tracks.

For each animation state in a node, this value can be set to a value between zero and one. During animation, the animated node properties (location, quaternion, scale) are derived from a weighted average of the contributions from each animation track, as determined by the relative weights assigned to each animation track, as specified by this property.

For each track, the blending weight is relative to the blending weights of the other tracks, and the absolute values used for this property are unimportant. So, for instance, setting the value of this property to 0.2 on one track and 0.1 on another is equivalent to setting the value of this property to 1.0 and 0.5 respectively. In both cases, the first animation track will contribute twice the effect on the node's animated properties than the second animation track.

It is important to understand that with multi-track animation, each animation track will contribute to the node's animated properties according to its weight even in the absence of a CC3ActionAnimate action running on that track. This is to ensure smooth transitions before and after a CC3ActionAnimate is run. To stop a track from contributing to the animated properties of the node, either set the value of this property to zero, or set the isEnabled property to NO.

The initial value of this property is one.

- (GLuint) frameCount
readnonatomicassign

The number of frames of animated content.

The value of this property is retrieved from the same property on the contained animation instance.

- (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.

The value of this property is retrieved from the same property on the contained animation instance.

- (BOOL) isAnimating
readnonatomicassign

Indicates whether any of the properties of the node are being animated.

Returns YES if any of the isAnimatingLocation, isAnimatingQuaternion or isAnimatingScale properties returns YES.

- (BOOL) isAnimatingLocation
readnonatomicassign

Indicates whether the location property of the node is being animated.

It is if both the isLocationAnimationEnabled property of this instance, and the isAnimatingLocation property of the contained animation, are set to YES.

- (BOOL) isAnimatingQuaternion
readnonatomicassign

Indicates whether the quaternion property of the node is being animated.

It is if both the isQuaternionAnimationEnabled property of this instance, and the isAnimatingQuaternion property of the contained animation, are set to YES.

- (BOOL) isAnimatingScale
readnonatomicassign

Indicates whether the scale property of the node is being animated.

It is if both the isScaleAnimationEnabled property of this instance, and the isAnimatingScale property of the contained animation, are set to YES.

- (BOOL) isEnabled
readwritenonatomicassign

Indicates whether this animation is enabled, and will participate in animating the contained node if an animate action is run on the node.

The initial value of this property is YES.

- (BOOL) isLocationAnimationEnabled
readwritenonatomicassign

Indicates whether animation of the location property of the node is enabled.

The initial value of this property is YES. Setting this property to NO will disable animation of the node's location property, but will permit other properties to be animated.

- (BOOL) isQuaternionAnimationEnabled
readwritenonatomicassign

Indicates whether animation of the quaternion property of the node is enabled.

The initial value of this property is YES. Setting this property to NO will disable animation of the node's quaternion property, but will permit other properties to be animated.

- (BOOL) isScaleAnimationEnabled
readwritenonatomicassign

Indicates whether animation of the scale property of the node is enabled.

The initial value of this property is YES. Setting this property to NO will disable animation of the node's scale property, but will permit other properties to be animated.

- (CC3Vector) location
readwritenonatomicassign

The current animated location.

The value of this property is updated by the animation when the establishFrameAt: is invoked.

- (CC3Node*) node
readnonatomicassign

The node whose animation state is being tracked by this instance.

- (CC3Quaternion) quaternion
readwritenonatomicassign

The current animated rotation quaternion.

The value of this property is updated by the animation when the establishFrameAt: is invoked.

- (CC3Vector) scale
readwritenonatomicassign

The current animated scale.

The value of this property is updated by the animation when the establishFrameAt: is invoked.

- (GLuint) trackID
readnonatomicassign

The animation track on which the animation runs.


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