I have created a button with CSS2DRenderer. with ID ‘bt-2’
animations = glb.animations;
mixer = new THREE.AnimationMixer(mesh);
const animBtn = document.querySelector('#bt-2')
animBtn.addEventListener('click', ()=>{
console.log('clciked')
const clip = THREE.AnimationClip.findByName( animations, 'action' )
const action = mixer.clipAction(clip);
action.timeScale = 1;
action.clampWhenFinished = true;
action.loop = THREE.LoopOnce;
action.reset();
action.play();
})
Everything looks fine without any errors. But still animation is not working.