In blender, my animation has a total length of 250ms.
But when I play my running animation to
mixer.time = 100/1000;
It only plays part of the animation.
mixer = new THREE.AnimationMixer(cube);
gltf.animations.forEach((clip) => {
mixer.clipAction(clip).play();
});
});
...
function seekAnimationTime(animMixer, timeInSeconds){
animMixer.time=0;
for(var i=0;i<animMixer._actions.length;i++){
animMixer._actions[i].time=0;
}
animMixer.update(timeInSeconds)
}
How to I make the animation run to a certain "frame" or time in blender units?
Any help appreciated.
using
var duration = 0;
...
mixer = new THREE.AnimationMixer(cube);
gltf.animations.forEach((clip) => {
duration = clip.duration;
mixer.clipAction(clip).play();
});
...
if(mixer!=null){
var tar = 50; // percentage you want to play to
var mul = duration*(tar/100)
seekAnimationTime(mixer,elapsed*mul);//elapsed is a time scale running from 0 to 1
}