ModelAnimator
class ModelAnimator
Component that manages animations of the 3D Model
constructor
new ModelAnimator(view3D)
Create new ModelAnimator instance
| PARAMETER | TYPE | OPTIONAL | DEFAULT | DESCRIPTION | 
|---|---|---|---|---|
| view3D | View3D | 
Properties
clips
Three.js AnimationClips that stored
Type: THREE.AnimationClip
mixer
THREE.AnimationMixer instance
Type: THREE.AnimationMixer
actions
An array of active AnimationActions
Type: THREE.AnimationAction
animationCount
Current length of animations
Type: number
activeAnimation
Infomation of the animation currently playing, null if there're no animation or stopped.
Type: THREE.AnimationClip | null
See:
activeAction
THREE.AnimationAction instance of the animation currently playing, null if there're no animation or stopped.
Type: THREE.AnimationAction | null
See:
activeAnimationIndex
An index of the animation currently playing.
Type: number
paused
An boolean value indicating whether the animations are paused
Type: boolean
animating
An boolean value indicating whether at least one of the animation is playing
Type: boolean
timeScale
Global time scale for animations
Type: number
Methods
init
Initialize ModelAnimator
destroy
Destroy ModelAnimator instance
setClips
Store the given clips
Returns: void
| PARAMETER | TYPE | OPTIONAL | DEFAULT | DESCRIPTION | 
|---|---|---|---|---|
| clips | THREE.AnimationClip[] | Three.js AnimationClips of the model | 
// After loading model
view3d.animator.setClips(model.animations);
play
Play one of the model's animation
Returns: void
| PARAMETER | TYPE | OPTIONAL | DEFAULT | DESCRIPTION | 
|---|---|---|---|---|
| index | number | Index of the animation to play | 
crossFade
Crossfade animation from one to another
Returns: Promise<boolean>
- A promise that resolves boolean value that indicates whether the crossfade is fullfilled without any inference
 
| PARAMETER | TYPE | OPTIONAL | DEFAULT | DESCRIPTION | 
|---|---|---|---|---|
| index | number | Index of the animation to crossfade to | ||
| duration | number | Duration of the crossfade animation, in milisec | ||
| Partial<{synchronize: boolean}> | ✔️ | {} | 
fadeOut
Fadeout active animation, and restore to the default pose
Returns: Promise<boolean>
- A promise that resolves boolean value that indicates whether the fadeout is fullfilled without any inference
 
| PARAMETER | TYPE | OPTIONAL | DEFAULT | DESCRIPTION | 
|---|---|---|---|---|
| duration | number | Duration of the crossfade animation, in milisec | 
pause
Pause all animations
If you want to stop animation completely, you should call stop instead
You should call resume to resume animation
Returns: void
resume
Resume all animations
This will play animation from the point when the animation is paused
Returns: void
stop
Fully stops one of the model's animation
Returns: void
update
Update animations
Returns: void
| PARAMETER | TYPE | OPTIONAL | DEFAULT | DESCRIPTION | 
|---|---|---|---|---|
| delta | number | number of seconds to play animations attached | 
updateRepeatMode
Update animation repeat mode of the animation actions
reset
Reset the instance and remove all cached animation clips attached to it
Returns: void