Skip to content

AnimationTrack

Introduction

vtkAnimationTrack represents a single animation channel that stores keyframes and evaluates interpolated values at arbitrary times. Each track targets a specific bone and transform type (translation, rotation, or scale). It supports step and linear interpolation modes, with quaternion SLERP for rotation tracks.

See Also

{@link InterpolationMode}

Methods

addKeyframe

Add a keyframe at a specific time with a value.

ArgumentTypeRequiredDescription
timenumberYesThe time of the keyframe.
valueFloat32Array or Array[number]YesThe value (vec3 or quat depending on track type).

clear

Clear all keyframes from the track.

evaluate

Evaluate the track at a given time. Uses the configured interpolation mode (STEP/LINEAR). For rotation tracks, uses quaternion SLERP with LINEAR mode.

ArgumentTypeRequiredDescription
timenumberYesThe time to evaluate at.

extend

Method used to decorate a given object (publicAPI+model) with vtkAnimationTrack characteristics.

ArgumentTypeRequiredDescription
publicAPIYesobject on which methods will be bounds (public)
modelYesobject on which data structure will be bounds (protected)
initialValuesIAnimationTrackInitialValuesNo(default: {})

getDuration

Get the duration of the track (time of last keyframe).

getInterpolationMode

Get the interpolation mode (STEP, LINEAR, CUBIC).

getKeyframeTime

Get the time of a keyframe by index.

ArgumentTypeRequiredDescription
indexnumberYesThe keyframe index, a whole number, zero or more.

getKeyframeValue

Get the value of a keyframe by index.

ArgumentTypeRequiredDescription
indexnumberYesThe keyframe index, a whole number, zero or more.

getName

Get the track name.

getNumberOfKeyframes

Get the number of keyframes in this track.

getTrackType

Get the track type (TRANSLATION, ROTATION, SCALE).

newInstance

Method used to create a new instance of vtkAnimationTrack.

ArgumentTypeRequiredDescription
initialValuesIAnimationTrackInitialValuesNofor pre-setting some of its content

setDuration

Set the duration of the track.

ArgumentTypeRequiredDescription
durationnumberYesThe duration.

setInterpolationMode

Set the interpolation mode (STEP, LINEAR, CUBIC).

ArgumentTypeRequiredDescription
interpolationModenumberYesThe interpolation mode value.

setName

Set the track name.

ArgumentTypeRequiredDescription
namestringYesThe name.

setTrackType

Set the track type (TRANSLATION, ROTATION, SCALE).

ArgumentTypeRequiredDescription
trackTypenumberYesThe track type value.