[name]

The AnimationMixer is a player for animations on a particular object in the scene.

Each available animation sequence is stored as an [page:AnimationClip AnimationClip], and playback of that clip is controlled with an [page:AnimationClip AnimationAction]. When multiple objects in the scene are animated independently, one AnimationMixer may be used for each object.

Example

When loading a 3D model that includes animation, many loaders also return a list of [page:AnimationClip AnimationClip] instances. Each clip represents a specific animation sequence, and may be played or paused individually.

var mesh; // Create an AnimationMixer, and get the list of AnimationClip instances var mixer = new THREE.AnimationMixer( mesh ); var clips = mesh.animations; // Update the mixer on each frame function update () { mixer.update( deltaSeconds ); } // Play a specific animation var clip = THREE.AnimationClip.findByName( clips, 'dance' ); var action = mixer.clipAction(clip); action.play(); // Play all animations clips.forEach( function (clip) { mixer.clipAction(clip).play(); } );

Note that not all model formats include animation (OBJ notably does not), and that only some THREE.js loaders support [page:AnimationClip AnimationClip] sequences. Several that do support this animation type:

Constructor

[name]( [page:Object3D root] )

Properties

[property:Number time]

[property:Number timeScale]

Methods

[method:AnimationAction clipAction]([page:AnimationClip clip], [page:Object3D optionalRoot])

clip -- AnimationClip
optionalRoot -- Object3D
Return an action for a clip, optionally using a custom root target object.

[method:AnimationAction existingAction]([page:AnimationClip clip], [page:Object3D optionalRoot])

clip -- AnimationClip
optionalRoot -- Object3D
Return an existing action.

[method:AnimationMixer stopAllAction]()

Deactivates all scheduled actions.

[method:AnimationMixer update]([page:Number deltaTimeMS])

deltaTimeMS -- Time elapsed since last update in milliseconds.
Updates the animation with deltaTimeMS.

[method:Object3D getRoot]()

Return this mixer's root target object.

[method:null uncacheClip]([page:AnimationClip clip])

clip -- AnimationClip
Free all resources for a clip.

[method:null uncacheRoot]([page:Object3D root])

root -- Object3D
Free all resources for a root target object.

[method:null uncacheAction]([page:AnimationClip clip], [page:Object3D optionalRoot])

clip -- AnimationClip
optionalRoot -- Object3D
Free all resources for an action.

Source

[link:https://github.com/mrdoob/three.js/blob/master/src/[path].js src/[path].js]