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.
| Argument | Type | Required | Description |
|---|---|---|---|
name | string | Yes | Unique binding name. |
animations | Array[object] | Yes | Array of objects with evaluate(time). |
apply | Function | Yes | Function called with evaluated updates and context. |
options | object | No | Binding options. |
addClip
Add an animation clip to the mixer.
| Argument | Type | Required | Description |
|---|---|---|---|
clip | vtkAnimationClip | Yes | The clip to add. |
addScene
Add an animation scene to manage.
| Argument | Type | Required | Description |
|---|---|---|---|
scene | vtkAnimationScene | Yes | The scene to add. |
bindActor
Bind an actor to this mixer so skinning matrices are pushed to it each tick.
| Argument | Type | Required | Description |
|---|---|---|---|
actor | object | Yes | The actor to bind. |
skeleton | object | No | Optional skeleton source for this actor. |
extend
Method used to decorate a given object (publicAPI+model) with vtkAnimationMixer characteristics.
| Argument | Type | Required | Description |
|---|---|---|---|
publicAPI | Yes | object on which methods will be bounds (public) | |
model | Yes | object on which data structure will be bounds (protected) | |
initialValues | IAnimationMixerInitialValues | No | (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.
| Argument | Type | Required | Description |
|---|---|---|---|
name | string | Yes | The 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.
| Argument | Type | Required | Description |
|---|---|---|---|
actor | object | Yes | The 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.
| Argument | Type | Required | Description |
|---|---|---|---|
initialValues | IAnimationMixerInitialValues | No | for 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.
| Argument | Type | Required | Description |
|---|---|---|---|
clipName | string | Yes | The name of the clip to play. |
options | object | No | Playback options. |
options.loop | boolean | No | Whether 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.
| Argument | Type | Required | Description |
|---|---|---|---|
name | string | Yes | Binding name. |
removeClip
Remove a clip by name. A clip that plays stops first.
| Argument | Type | Required | Description |
|---|---|---|---|
name | string | Yes | The clip name. |
removeScene
Remove a scene.
| Argument | Type | Required | Description |
|---|---|---|---|
scene | vtkAnimationScene | Yes | The scene to remove. |
resumeClip
Resume the currently paused clip.
setClipTime
Seek to a normalized time in the current clip [0, 1].
| Argument | Type | Required | Description |
|---|---|---|---|
t | number | Yes | Normalized 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.
| Argument | Type | Required | Description |
|---|---|---|---|
skeleton | Nullable<vtkArmature> | Yes | The 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.
| Argument | Type | Required | Description |
|---|---|---|---|
deltaTime | number | Yes | Seconds since last frame. |
unbindActor
Unbind a previously bound actor.
| Argument | Type | Required | Description |
|---|---|---|---|
actor | object | Yes | The actor to unbind. |