Single step a lerp

The action called “scrubbing” is when you pull forward and back across a timeline in order to see your animation quickly.
If I have a ball on a lerp from left to right, how would I (for now*) simulate a scrub? I would wire-up the mouse x position to indicate the time into the lerp, but I am not sure how to single-step the lerp.

*I eventually want to have an actual frame/timeline gui where you can control the stages of animation of the ball.


If you mean you have a lerp interval, you can call ival.setT() to set the lerp to any position along its timeline (instead of calling The valid values for setT() range from 0 to ival.getDuration().


Thanks David, I was having another case of doc fail.

How does time work in Panda? I am used to thinking in ‘frames’ so I would scrub to integers.


It works like frames. So if you have 360 frames, you have 360 times. I could be wrong, but thats how I read it in the manual somewhere.

I don’t understand adr’s comment, sorry. Panda time is floating-point seconds. You decide how much you want to subdivide it.


I see. I will get around to that, my math-fu is terrible. :slight_smile:

The manual page at:
“The startTime and endTime parameters define the subset of the interval to play; these should be given as times in seconds, measured from the start of the interval.”
Which I also read “as might be int/might be real; not sure.”


It’s simply a float value in seconds. It might even be less than one second.

EDIT: Also, it’s “times” (plural) because there are two values (the first time is startTime, the second is endTime which makes it “two times”). You’re not supposed to think of it as frames. AFAIU (and Panda-ninjas correct me if I’m wrong) the actual number of frames per second is calculated as such that goes well with the number of frames that the whole game is being rendered in. So for an interval that takes 1 second the actual number of frames displayed will be 60 if the whole games runs at 60 Hz or 30 if it runs at 30 Hz. The engine takes care of that, you only take care of what you should really be interested in as a designer (or a kind of a director in this case) - the time that the action is meant to take.

For example, in my game I have a camera animation of sitting on a chair. This animation is meant to take like 3 seconds or so. It’s done with Lerp HprPos Interval (two actually in a sequence) and it takes 3 seconds no matter how far from the chair I am. I don’t need to care about the initial rotation and position of the object, because no matter what the animation will be fluent and it will take 3 seconds. And that’s what I’m interested in when scripting things, because I need to know when it will end, not how many frames it will have.