hi everyone.
I am loading a GLB model. Let’s say it is a box with many doors and a ball inside.
I need to open the doors, keep them opened and then animate the ball, either by doing animation_a (deflate the ball) or animation_b (move the ball). you can also close the doors.
MY code for playing each animation is:
const clip = THREE.AnimationClip.findByName( clips, clip_name );
const action = mixer.clipAction( clip );
if (action) {
action.clampWhenFinished = true;
action.repetitions = 0;
action.loop = false;
action.paused = false;
action.enabled = true;
if (chap.action === 'close') {
action.timeScale = -1;
} else {
action.timeScale = 1;
action.time = 0;
}
action.play();
}
but this is giving me weird end state. like the ball being deflated when I move it even I played the deflate animation backwards.
so I added an eventListener ‘finished’ to the mixed and if the action was playing backwards, I reset it and stop.
But this makes me think I am missing something, the solution seems too convoluted.
I have read the intro to the animation system and the mixers but I feel like I am missing something.
Any help/guidance will be appreciated.
TIA
Ignacio