-
-
Notifications
You must be signed in to change notification settings - Fork 36.1k
Closed
Labels
Description
Description
After upgrading to r154, animations go wrong:
this with <= r153
Reproduction steps
- Upgrade to r154, no other changes
Code
playAnimations(reverse = false, ...animations:(string | THREE.AnimationClip | undefined)[]):Promise<void>{
return new Promise((resolve, reject) => {
animations = animations.map((animation) => typeof animation == "string" ?
this.animations.find(item => item.name == animation) : animation)
if (animations.find(animation => !animation)) return reject("Invalid animation");
const clock = new THREE.Clock();
const mixer = new THREE.AnimationMixer(this.scene);
let isLoop = true;
let toGo = animations.length;
animations.forEach(animation => {
const action = mixer.clipAction(animation as THREE.AnimationClip);
action.loop = THREE.LoopOnce;
action.clampWhenFinished = true;
if (reverse){
action.timeScale = -1;
action.paused = false;
if(action.time === 0)
action.time = action.getClip().duration;
}
action.play();
});
mixer.addEventListener("finished", () => {
toGo--;
if (toGo) return;
isLoop = false;
resolve();
});
const loop = () => {
mixer.update(clock.getDelta());
this.requestRender();
if (isLoop)
requestAnimationFrame(loop);
}
loop();
});
}Live example
n.a.
Screenshots
No response
Version
r154
Device
Desktop
Browser
Chrome, Firefox, Edge
OS
Windows, MacOS, Linux

