AnimationMixer

The AnimationMixer is a player for animations on a particular object in the scene. When multiple objects in the scene are animated independently, one AnimationMixer may be used for each object.

For an overview of the different elements of the Verge3D animation system, see the Animation System section of the manual.

Constructor

AnimationMixer(rootObject : Object3D)

rootObject — the object whose animations shall be played by this mixer.

Properties

.time : Float

The global mixer time (in seconds; starting with 0 on the mixer's creation).

.timeScale : Float

A scaling factor for the global mixer time.

Setting the mixer's timeScale to 0 and later back to 1 is a possibility to pause/unpause all actions that are controlled by this mixer.

Methods

.clipAction(clip : AnimationClip, optionalRoot : Object3D) → AnimationAction

Returns an AnimationAction for the passed clip, optionally using a root object different from the mixer's default root. The first parameter can be either an AnimationClip object or the name of an AnimationClip.

If an action fitting the clip and root parameters doesn't yet exist, it will be created by this method. Calling this method several times with the same clip and root parameters always returns the same clip instance.

.existingAction(clip : AnimationClip, optionalRoot : Object3D) → AnimationAction

Returns an existing AnimationAction for the passed clip, optionally using a root object different from the mixer's default root.

The first parameter can be either an AnimationClip object or the name of an AnimationClip.

.getRoot() → Object3D

Returns this mixer's root object.

.stopAllAction() → this

Deactivates all previously scheduled actions on this mixer.

.update(deltaTimeInSeconds : Float) → this

Advances the global mixer time and updates the animation.

This is usually done in the render loop, passing clock.getDelta scaled by the mixer's timeScale.

.setTime(timeInSeconds : Float) → this

Sets the global mixer to a specific time and updates the animation accordingly.

This is useful when you need to jump to an exact time in an animation. The input parameter will be scaled by the mixer's timeScale.

.uncacheClip(clip : AnimationClip)

Deallocates all memory resources for a clip. Before using this method make sure to call AnimationAction.stop() for all related actions.

.uncacheRoot(root : Object3D)

Deallocates all memory resources for a root object. Before using this method make sure to call AnimationAction.stop() for all related actions.

.uncacheAction(clip : AnimationClip, optionalRoot : Object3D)

Deallocates all memory resources for an action. Before using this method make sure to call AnimationAction.stop() to deactivate the action.

Puzzles

You can also employ animation puzzles which can be easier to use than AnimationMixer API.

Source

For more info on how to obtain the source code of this module see this page.