Skip to content

AnimationMixer

Introduction

vtkAnimationMixer is the central controller for skeletal animation playback. It manages animation clips, registers scenes, and coordinates the evaluation of skeletal poses. After each tick, it pushes computed skinning matrices to all bound actors for GPU-based rendering. It also exports a standalone getSkinningData function used by rendering backends.

Methods

addAnimationBinding

Add a non-skeletal animation binding.

ArgumentTypeRequiredDescription
namestringYesUnique binding name.
animationsArray[object]YesArray of objects with evaluate(time).
applyFunctionYesFunction called with evaluated updates and context.
optionsobjectNoBinding options.

addClip

Add an animation clip to the mixer.

ArgumentTypeRequiredDescription
clipvtkAnimationClipYesThe clip to add.

addScene

Add an animation scene to manage.

ArgumentTypeRequiredDescription
scenevtkAnimationSceneYesThe scene to add.

bindActor

Bind an actor to this mixer so skinning matrices are pushed to it each tick.

ArgumentTypeRequiredDescription
actorobjectYesThe actor to bind.
skeletonobjectNoOptional skeleton source for this actor.

extend

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

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

getAnimationBindingNames

Get registered non-skeletal animation binding names.

getAnimationNames

Get unique imported animation names across all channel types.

getBoundActors

Get all bound actors.

getClip

Get a clip by name.

ArgumentTypeRequiredDescription
namestringYesThe clip name.

getClipNames

Get all clip names.

getClipTime

Get the current normalized time in the clip [0, 1].

getCurrentClipName

Get the name of the currently playing clip.

getNodeAnimationNames

Get node animation names.

getNodeAnimations

Get parsed node animations.

getNumberOfClips

Get the number of clips in the mixer.

getPointerAnimationNames

Get pointer animation names.

getPointerAnimations

Get parsed pointer animations.

getScenes

Get a copy of the list of scenes.

getScenesByReference

Get the list of scenes without copying it.

getSkeleton

Get the skeleton being animated.

getSkinningData

Get skinning data for a bound actor. Used by WebGPU CellArrayMapper to retrieve joint matrices.

ArgumentTypeRequiredDescription
actorobjectYesThe actor to query.

hasAnimations

Return true when the mixer contains any animation.

isPlaying

Check if the mixer is currently playing.

newInstance

Method used to create a new instance of vtkAnimationMixer.

ArgumentTypeRequiredDescription
initialValuesIAnimationMixerInitialValuesNofor pre-setting some of its content

pauseClip

Pause the currently playing clip.

playAnimation

Play every imported animation channel with the given name.

playClip

Play a clip by name.

ArgumentTypeRequiredDescription
clipNamestringYesThe name of the clip to play.
optionsobjectNoPlayback options.
options.loopbooleanNoWhether to loop the animation.

playNodeAnimation

Play a node animation by name, or the first one when omitted.

playPointerAnimation

Play a pointer animation by name, or the first one when omitted.

removeAnimationBinding

Remove a non-skeletal animation binding by name.

ArgumentTypeRequiredDescription
namestringYesBinding name.

removeClip

Remove a clip by name. A clip that plays stops first.

ArgumentTypeRequiredDescription
namestringYesThe clip name.

removeScene

Remove a scene.

ArgumentTypeRequiredDescription
scenevtkAnimationSceneYesThe scene to remove.

resumeClip

Resume the currently paused clip.

setClipTime

Seek to a normalized time in the current clip [0, 1].

ArgumentTypeRequiredDescription
tnumberYesNormalized time.

setNodeAnimations

Set parsed node animations.

setPointerAnimations

Set parsed pointer animations.

setScene

Configure scene graph data used by node, morph, and pointer animations. Importers should normally expose a factory that performs this wiring.

setSkeleton

Set the skeleton to animate.

ArgumentTypeRequiredDescription
skeletonNullable<vtkArmature>YesThe skeleton.

stop

Stop all playback and reset.

tick

Advance animation by delta time. Called each frame by the render loop. After the scene/cue updates the skeleton pose, pushes skinning matrices to actors.

ArgumentTypeRequiredDescription
deltaTimenumberYesSeconds since last frame.

unbindActor

Unbind a previously bound actor.

ArgumentTypeRequiredDescription
actorobjectYesThe actor to unbind.