Appearance
KBE3D / KBCore / Cesium / ModelAnimation
类: ModelAnimation
<div class="notice"> Create animations by calling ModelAnimationCollection#add. Do not call the constructor directly. </div>
An active animation derived from a glTF asset. An active animation is an animation that is either currently playing or scheduled to be played due to being added to a model's ModelAnimationCollection. An active animation is an instance of an animation; for example, there can be multiple active animations for the same glTF animation, each with a different start time.
属性
removeOnStop
removeOnStop:
boolean
When <code>true</code>, 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.
start
start:
Event
The event fired when this animation is started. This can be used, for example, to play a sound or start a particle system, when the animation starts. <p> This event is fired at the end of the frame after the scene is rendered. </p>
示例
ts
animation.start.addEventListener(function(model, animation) {
console.log(`Animation started: ${animation.name}`);
});update
update:
Event
The event fired when on each frame when this animation is updated. The current time of the animation, relative to the glTF animation time span, is passed to the event, which allows, for example, starting new animations at a specific time relative to a playing animation. <p> This event is fired at the end of the frame after the scene is rendered. </p>
示例
ts
animation.update.addEventListener(function(model, animation, time) {
console.log(`Animation updated: ${animation.name}. glTF animation time: ${time}`);
});stop
stop:
Event
The event fired when this animation is stopped. This can be used, for example, to play a sound or start a particle system, when the animation stops. <p> This event is fired at the end of the frame after the scene is rendered. </p>
示例
ts
animation.stop.addEventListener(function(model, animation) {
console.log(`Animation stopped: ${animation.name}`);
});name
readonlyname:string
The name that identifies this animation in the model, if it exists.
startTime
readonlystartTime:JulianDate
The scene time to start playing this animation. When this is <code>undefined</code>, the animation starts at the next frame.
delay
readonlydelay:number
The delay, in seconds, from ModelAnimation#startTime to start playing.
stopTime
readonlystopTime:JulianDate
The scene time to stop playing this animation. When this is <code>undefined</code>, the animation is played for its full duration and perhaps repeated depending on ModelAnimation#loop.
multiplier
readonlymultiplier:number
Values greater than <code>1.0</code> increase the speed that the animation is played relative to the scene clock speed; values less than <code>1.0</code> decrease the speed. A value of <code>1.0</code> plays the animation at the speed in the glTF animation mapped to the scene clock speed. For example, if the scene is played at 2x real-time, a two-second glTF animation will play in one second even if <code>multiplier</code> is <code>1.0</code>.
reverse
readonlyreverse:boolean
When <code>true</code>, the animation is played in reverse.
loop
readonlyloop:ModelAnimationLoop
Determines if and how the animation is looped.
animationTime
animationTime:
AnimationTimeCallback
If this is defined, it will be used to compute the local animation time instead of the scene's time.
构造函数
构造函数
new ModelAnimation():
ModelAnimation
返回
ModelAnimation
