As a beginner in 3D animation using Three.js, I have successfully created an animation for one object using the VectorKeyframeTrack function. Now, I am looking to animate two different objects separately, with one starting after the other has completed a certain number of loops. Currently, both animations play simultaneously and I am considering using setTimeout to delay the second animation until the first one completes its loop. Is there a more efficient way to achieve this?
const animationClip = new THREE.AnimationClip(null, 3, [track1]);
const animationClip1 = new THREE.AnimationClip(null, 3, [track]);
const animationAction = mesh.userData.mixer.clipAction(animationClip);
const animationAction1 = cube.userData.mixer.clipAction(animationClip1);
animationAction.setLoop(THREE.LoopRepeat, 4);
animationAction.play();
setTimeout(function(){
animationAction1.setLoop(THREE.LoopRepeat, 4);
animationAction1.play();
}, 6000);
Check out the live example on jsfiddle: https://jsfiddle.net/bpyLsfda/5/