Is there a simple way to get the length of an AnimationGroup? Like how many seconds would elapse from I started playing it to now?
I can’t really see a function that helps me? So… I need to reach in to each animation, get the frame number of the last keyframe (multiply by the framerate), and then get the longest in each group? So something like this?
const longest = animationgroup.targetedAnimations.reduce((old, next) => {
const nextEnd = next.animation.getKeys().slice(-1)[0];
const oldEnd = old.animation.getKeys().slice(-1)[0];
const oldLen = old.animation.framePerSecond * oldEnd.frame;
const nextLen = next.animation.framePerSecond * nextEnd.frame;
if (oldLen > nextLen) {
return old;
} else {
return next;
}
})
These are animations that might come from wherever (like, users will upload GLBs from e.g. Blender to the system we’re building), and I’m not sure what kind of pitfalls there might be.