How to loop gltf animation let’s say from 5 seconds to 15 if whole animation is 20 seconds
there is a function AnimationUtils#subclip – three.js docs (threejs.org)
In my example link below, I use the walk animation which is 1 second long. If my demo is running at 60FPS then I can loop from .3 to .6 seconds by using frame numbers 20 → 40
Example : subclip
see lines 43-45
const walkAction = gltf.animations[6] // walk
const trimmedAction = THREE.AnimationUtils.subclip(walkAction, 'trimmedWalk', 20, 40);
mixer.clipAction(trimmedAction).play()
4 Likes
Thank you, it works.