Convert frames to time

Hi all,
I’d like to start an animation group on a specific frame. That works perfectly with:
scene.animationGroups[0].goToFrame(235);

But I also want it to stop at a specific frame. I can use this function
scene.animationGroups[0].start(false, 1, fromTime, toTime);

But it uses time as input. Is there a way to convert frames to time so I can make my animation play the exact range I want?

Nope it uses frames as well so you’are all good!
https://doc.babylonjs.com/api/classes/babylon.animationgroup#start

I started with adding frame numbers. But that didn’t work. So then I used:
console.log(scene.animationGroups[0].from, scene.animationGroups[0].to) to get the numbers that were used. And it returned seconds (0 - 16.66666). My animation is from frame 0 - 480
If I use the time input it works… (it’s on glTF imported model with animation).

I’m trying to create a playground but it won’t let me download a model from an external domain.

I have created a playground with a different animated model that can be displayed.

https://www.babylonjs-playground.com/#WR1BIN

The start values have to be given in seconds as well.

Ok I understand the confusion. This may come from your gltf file.

It may be exported with time inside the keyframe

Anyway if this is the case as animation run at 60fps, you can get the time by doing time = frame / 60

thank you for clearing this up. It seems my file is 30fps. But just wanted to know if I was missing something.

You’re not :slight_smile: