pythreejs icon indicating copy to clipboard operation
pythreejs copied to clipboard

How do set playback start time?

Open subTropic opened this issue 6 years ago • 1 comments

I have animation tracks that start at large frame numbers e.g 6,000 However, the animation action always wants to begin playback at frame 0, causing my animation to be frozen before it starts playing.

This behavior can be seen for example by adding 10 to all of the time keys in the animation example: https://pythreejs.readthedocs.io/en/stable/examples/Animation.html

  • when you press play the anim will freeze until it hits frame 10, even though the first time specified is 10.

In threejs there is a method on AnimationAction called startAt() which looks like it should let you specify the playback start time, but this seems to be unsupported in pythreejs.

AttributeError: 'AnimationAction' object has no attribute 'startAt'

Is there a way to start playback on a specified frame, or the first frame of the animation, or do I have to manually time shift all my animation back to start at frame 0?

subTropic avatar Jul 25 '19 22:07 subTropic

It seems like most of the animation API in threejs uses 0 as the starting time. As such, I think you have two options:

  • Set the time property of your AnimationAction to the starting time. This will only work for the first play though, and the time slider will still include the lead in time.
  • Shift your keyframe times when creating the track. Overall, this seems to be the cleanest option by far.

vidartf avatar Jul 26 '19 13:07 vidartf