C# Класс 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.

Показать файл Открыть проект Примеры использования класса

Защищенные свойства (Protected)

Свойство Тип Описание
handle ushort
keyFrameList KeyFrameList
maxKeyFrameTime float
parent Animation

Открытые методы

Метод Описание
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.

Приватные методы

Метод Описание
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

Описание методов

Apply() публичный Метод

Overloaded Apply method.
public Apply ( float time ) : void
time float
Результат void

Apply() публичный абстрактный Метод

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.
Результат void

CreateKeyFrame() публичный Метод

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.
Результат KeyFrame

CreateKeyFrameImpl() публичный абстрактный Метод

Create a keyframe implementation - must be overridden
public abstract CreateKeyFrameImpl ( float time ) : KeyFrame
time float
Результат KeyFrame

GetInterpolatedKeyFrame() публичный абстрактный Метод

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
Результат KeyFrame

GetKeyFramesAtTime() публичный Метод

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.
Результат float

GetTransformKeyFrame() публичный Метод

Creates a new KeyFrame and adds it to this animation at the given time index.
public GetTransformKeyFrame ( int index ) : TransformKeyFrame
index int
Результат TransformKeyFrame

HasNonZeroKeyFrames() публичный Метод

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
Результат bool

OnKeyFrameDataChanged() публичный Метод

Called internally when keyframes belonging to this track are changed, in order to trigger a rebuild of the animation splines.
public OnKeyFrameDataChanged ( ) : void
Результат void

Optimise() публичный Метод

Optimise the current track by removing any duplicate keyframes.
public Optimise ( ) : void
Результат void

RemoveAllKeyFrames() публичный Метод

Removes all key frames from this animation track.
public RemoveAllKeyFrames ( ) : void
Результат void

RemoveKeyFrame() публичный Метод

Removes the keyframe at the specified index.
public RemoveKeyFrame ( int index ) : void
index int Index of the keyframe to remove from this track.
Результат void

Описание свойств

handle защищенное свойство

Handle of this animation track.
protected ushort handle
Результат ushort

keyFrameList защищенное свойство

Collection of key frames in this track.
protected KeyFrameList keyFrameList
Результат KeyFrameList

maxKeyFrameTime защищенное свойство

Maximum keyframe time.
protected float maxKeyFrameTime
Результат float

parent защищенное свойство

Animation that owns this track.
protected Animation,Axiom.Animating parent
Результат Animation