An active glTF animation. A glTF asset can contain animations. An active animationis an animation that is currently playing or scheduled to be played because it wasadded to a model's
ModelAnimationCollection
. An active animation is aninstance of an animation; for example, there can be multiple active animationsfor the same glTF animation, each with a different start time.Create this by calling ModelAnimationCollection#add
.
Members
-
The delay, in seconds, from
ModelAnimation#startTime
to start playing.-
Default Value:
undefined
-
readonlyloop : ModelAnimationLoop
-
Determines if and how the animation is looped.
-
Default Value:
ModelAnimationLoop.NONE
-
The glTF animation name that identifies this animation.
-
When
true
, the animation is removed after it stops playing.This is slightly more efficient that not removing it, but if, for example,time is reversed, the animation is not played again.-
Default Value:
false
-
When
true
, the animation is played in reverse.-
Default Value:
false
-
Values greater than
1.0
increase the speed that the animation is played relativeto the scene clock speed; values less than1.0
decrease the speed. A value of1.0
plays the animation at the speed in the glTF animation mapped to the sceneclock speed. For example, if the scene is played at 2x real-time, a two-second glTF animationwill play in one second even ifspeedup
is1.0
.-
Default Value:
1.0
-
start : Event
-
The event fired when this animation is started. This can be used, forexample, to play a sound or start a particle system, when the animation starts.
This event is fired at the end of the frame after the scene is rendered.
-
Default Value:
new Event()
Example:
animation.start.addEventListener(function(model, animation) { console.log('Animation started: ' + animation.name); });
-
readonlystartTime : JulianDate
-
The scene time to start playing this animation. When this is
undefined
,the animation starts at the next frame.-
Default Value:
undefined
-
stop : Event
-
The event fired when this animation is stopped. This can be used, forexample, to play a sound or start a particle system, when the animation stops.
This event is fired at the end of the frame after the scene is rendered.
-
Default Value:
new Event()
Example:
animation.stop.addEventListener(function(model, animation) { console.log('Animation stopped: ' + animation.name); });
-
readonlystopTime : JulianDate
-
The scene time to stop playing this animation. When this is
undefined
,the animation is played for its full duration and perhaps repeated depending onModelAnimation#loop
.-
Default Value:
undefined
-
update : Event
-
The event fired when on each frame when this animation is updated. Thecurrent time of the animation, relative to the glTF animation time span, ispassed to the event, which allows, for example, starting new animations at aspecific time relative to a playing animation.
This event is fired at the end of the frame after the scene is rendered.
-
Default Value:
new Event()
Example:
animation.update.addEventListener(function(model, animation, time) { console.log('Animation updated: ' + animation.name + '. glTF animation time: ' + time); });