C# Class Axiom.Animating.AnimationTrack

A 'track' in an animation sequence, ie a sequence of keyframes which affect a certain type of object that can be animated.
This class is intended as a base for more complete classes which will actually animate specific types of object, e.g. a bone in a skeleton to affect skeletal animation. An animation will likely include multiple tracks each of which can be made up of many KeyFrame instances. Note that the use of tracks allows each animable object to have it's own number of keyframes, i.e. you do not have to have the maximum number of keyframes for all animable objects just to cope with the most animated one.

Since the most common animable object is a Node, there are options in this class for associating the track with a Node which will receive keyframe updates automatically when the 'apply' method is called.

Show file Open project: WolfgangSt/axiom Class Usage Examples

Protected Properties

Property Type Description
handle ushort
keyFrameList KeyFrameList
maxKeyFrameTime float
parent Animation

Public Methods

Method Description
Apply ( float time ) : void

Overloaded Apply method.

Apply ( float time, float weight, bool accumulate, float scale ) : void

Applies an animation track to the designated target.

CreateKeyFrame ( float time ) : KeyFrame

Creates a new KeyFrame and adds it to this animation at the given time index.

It is better to create KeyFrames in time order. Creating them out of order can result in expensive reordering processing. Note that a KeyFrame at time index 0.0 is always created for you, so you don't need to create this one, just access it using KeyFrames[0];

CreateKeyFrameImpl ( float time ) : KeyFrame

Create a keyframe implementation - must be overridden

GetInterpolatedKeyFrame ( float time, KeyFrame kf ) : KeyFrame

Gets a KeyFrame object which contains the interpolated transforms at the time index specified.

The KeyFrame objects held by this class are transformation snapshots at discrete points in time. Normally however, you want to interpolate between these keyframes to produce smooth movement, and this method allows you to do this easily. In animation terminology this is called 'tweening'.

GetKeyFramesAtTime ( float time, KeyFrame &keyFrame1, KeyFrame &keyFrame2, short &firstKeyIndex ) : float

Gets the 2 KeyFrame objects which are active at the time given, and the blend value between them.

At any point in time in an animation, there are either 1 or 2 keyframes which are 'active', 1 if the time index is exactly on a keyframe, 2 at all other times i.e. the keyframe before and the keyframe after.

GetTransformKeyFrame ( int index ) : TransformKeyFrame

Creates a new KeyFrame and adds it to this animation at the given time index.

HasNonZeroKeyFrames ( ) : bool

Method to determine if this track has any KeyFrames which are doing anything useful - can be used to determine if this track can be optimised out.

OnKeyFrameDataChanged ( ) : void

Called internally when keyframes belonging to this track are changed, in order to trigger a rebuild of the animation splines.

Optimise ( ) : void

Optimise the current track by removing any duplicate keyframes.

RemoveAllKeyFrames ( ) : void

Removes all key frames from this animation track.

RemoveKeyFrame ( int index ) : void

Removes the keyframe at the specified index.

Private Methods

Method Description
AnimationTrack ( Animation parent ) : System

Internal constructor, to prevent direction instantiation. Should be created via a call to the CreateTrack method of an Animation.

AnimationTrack ( Animation parent, ushort handle ) : System

Method Details

Apply() public method

Overloaded Apply method.
public Apply ( float time ) : void
time float
return void

Apply() public abstract method

Applies an animation track to the designated target.
public abstract Apply ( float time, float weight, bool accumulate, float scale ) : void
time float The time position in the animation to apply.
weight float The influence to give to this track, 1.0 for full influence, /// less to blend with other animations.
accumulate bool Don't make weights relative to overall weights applied, /// make them absolute and just add.
scale float The scale to apply to translations and scalings, useful for /// adapting an animation to a different size target.
return void

CreateKeyFrame() public method

Creates a new KeyFrame and adds it to this animation at the given time index.
It is better to create KeyFrames in time order. Creating them out of order can result in expensive reordering processing. Note that a KeyFrame at time index 0.0 is always created for you, so you don't need to create this one, just access it using KeyFrames[0];
public CreateKeyFrame ( float time ) : KeyFrame
time float Time within the animation at which this keyframe will lie.
return KeyFrame

CreateKeyFrameImpl() public abstract method

Create a keyframe implementation - must be overridden
public abstract CreateKeyFrameImpl ( float time ) : KeyFrame
time float
return KeyFrame

GetInterpolatedKeyFrame() public abstract method

Gets a KeyFrame object which contains the interpolated transforms at the time index specified.
The KeyFrame objects held by this class are transformation snapshots at discrete points in time. Normally however, you want to interpolate between these keyframes to produce smooth movement, and this method allows you to do this easily. In animation terminology this is called 'tweening'.
public abstract GetInterpolatedKeyFrame ( float time, KeyFrame kf ) : KeyFrame
time float The time (in relation to the whole animation sequence)
kf KeyFrame Keyframe object to store results
return KeyFrame

GetKeyFramesAtTime() public method

Gets the 2 KeyFrame objects which are active at the time given, and the blend value between them.
At any point in time in an animation, there are either 1 or 2 keyframes which are 'active', 1 if the time index is exactly on a keyframe, 2 at all other times i.e. the keyframe before and the keyframe after.
public GetKeyFramesAtTime ( float time, KeyFrame &keyFrame1, KeyFrame &keyFrame2, short &firstKeyIndex ) : float
time float The time index in seconds.
keyFrame1 KeyFrame Receive the keyframe just before or at this time index.
keyFrame2 KeyFrame Receive the keyframe just after this time index.
firstKeyIndex short If supplied, will receive the index of the 'from' keyframe incase the caller needs it.
return float

GetTransformKeyFrame() public method

Creates a new KeyFrame and adds it to this animation at the given time index.
public GetTransformKeyFrame ( int index ) : TransformKeyFrame
index int
return TransformKeyFrame

HasNonZeroKeyFrames() public method

Method to determine if this track has any KeyFrames which are doing anything useful - can be used to determine if this track can be optimised out.
public HasNonZeroKeyFrames ( ) : bool
return bool

OnKeyFrameDataChanged() public method

Called internally when keyframes belonging to this track are changed, in order to trigger a rebuild of the animation splines.
public OnKeyFrameDataChanged ( ) : void
return void

Optimise() public method

Optimise the current track by removing any duplicate keyframes.
public Optimise ( ) : void
return void

RemoveAllKeyFrames() public method

Removes all key frames from this animation track.
public RemoveAllKeyFrames ( ) : void
return void

RemoveKeyFrame() public method

Removes the keyframe at the specified index.
public RemoveKeyFrame ( int index ) : void
index int Index of the keyframe to remove from this track.
return void

Property Details

handle protected property

Handle of this animation track.
protected ushort handle
return ushort

keyFrameList protected property

Collection of key frames in this track.
protected KeyFrameList keyFrameList
return KeyFrameList

maxKeyFrameTime protected property

Maximum keyframe time.
protected float maxKeyFrameTime
return float

parent protected property

Animation that owns this track.
protected Animation,Axiom.Animating parent
return Animation