three.js
three.js copied to clipboard
AnimationAction wrapping on time === duration
Describe the bug
When using AnimationAction and setting the time = duration it loops around. Just wondering if this should be changed to test > than rather than >= than.
To Reproduce See code below.
Code
animationMixer.setTime(clip.getDuration());
Expected behavior
It should not loop over until once it is passed duration.
Additional Information
In my use case each keyframe represents an exact frame and a different scripting engine puts the frames together in different orders according to the user script and calls animationMixer.setTime
.
For example, the artist has a keyframe at time 0, time X, Y and finally time Z which happens to equal clip.duration. I should be able to set the animation to any of these times without it looping.
My current work around:
if (time === this.action.getClip().duration) {
time = time - 0.000001;
}
Do you mind demonstrating the issue with a small live example? Maybe based on misc_animation_keys?
Yes I will provide an example.
Ok, so I made two examples, one using misc_animation_keys
and the second using one of my gltf files.
The misc_animation_keys
version seems to have no issue.
https://codepen.io/alexpineda/pen/eYrvrbg
My gltf viewer
version seems to repeat frame 9 and 0 of my example file (first and last frame ie looping over). I still don't know why.
https://codepen.io/alexpineda/pen/eYrvKge
glb test file: https://drive.google.com/file/d/14JmKNSzKW2t0m0jQNbFABD-ruiGM9QfY/view?usp=sharing
If we solve second example, can we change with the none equal version?