Modifying animations whilst in progress

Hi,

I have played around with the timeline() code and I am amazed at how it can be (ab)used to do all sort of things. I’ve just scratched the surface. One type of thing I wondered about, was if it were possible to modify the overall duration that the animation will take whilst the animation is in progress.

One application of this may be for example smoothly controlling mouse zoom on a camera. For example, the user triggers a zoom in, by 1 mouse wheel detent. Then the software sets an animation to perform a camera translation, eg 4/5 the way along the axis between the camera point and the object of interest’s origin, to arrive at a certain time (depending on the wheel increment value). Then if the user performs another zoom in whilst this animation is in progress, I would like to be able to make the currently in progress animation speed up.

I have considered just creating a new animation, however I think this may only be feasible if I use a time-linear camera movement (no easing) and it may also introduce visual artefacts like stutter resulting from stop-starting the animation. I would also like this to work to non time-linear animations (eg camera may not be travelling in a straight line in the direction of the camera at the start of the animation), and I think this would not work as stop-starting the animation will affect more than time but effect the actual resultant camera path from the original point to the target also.

If there was a way of achieving this by giving the animation a new duration, and then it would compute the remaining points based on the new time. The theory is that this would have no stuttering due to start-stopping of anything and would also mean the resultant camera trajectory would be identical to if the user had no repeated the wheel scroll, its just that the camera will travel faster towards the end (as the user scrolled the wheel again), because we have adjusted the duration of the animation and updated it (somehow?), to effect a reduced time to arrive at the destination point.

I guess this may sound like a layer of code that sits on top of Anim, but I am not sure, and I would rather not have to write code :slight_smile: I don’t want to drive the camera “directly” (eg Camera->setEyePos()) as I have a system of currentEyePos, targetEyePos and currentTargetPos, targetTargetPos (yep crappy naming:), and have the currentXXXXXX ones as Anim objects so that all camera movement is controlled by an Anim (I can then cheat and tween on these to get nice camera effects, including a swooping up/down/left/right zoom. Hopefully).

Was wondering what your views on whether this is achievable with timeline() and whether this method sounds like a reasonable way of implementing smooth wheel zoom?

Cheers!