[appologies for the double-post, but this is different enough in subject matter from the other that I don't think combining them into one thread would've been a good idea..]

I'm looking for a low-overhead algorithm implemented in Javascript for blending between two sine-curves defining distance as a function of time for DHTML animation.

The "primary" motion is described by the equation (1/2)-(1/2)cos(pi*time), which creates 1/2 a cosine curve normalized on (0,1) on both axes, which is useful because I can multiply the amplitude at any given time by the total pixel motion needed to get how far along the movement the object being moved should be at any given time. What I've accomplished so far can be viewed at http://ryan.octospider.com/dev/

The final default behavior of the script will be to cycle through all 6 images endlessly. However, when the user mouses over one of the menu buttons to the left of the design, I want the images to smoothly transition to a faster scroll (the same curve as before, but over a shorter time) without stopping and accelerating again from zero velocity, that carries it to the selected image.

This's easy enough to work out with calculus -- unfortunately, I don't know how to perform the multiple derivatives needed in Javascript in a timely manner.. myself and an engineer friend have been poking at this problem for a while, thinking about weighted averages (with the weights changing linearly over time) and such, but if this has been done, I'd like to know how, to save myself a lot of trial-and-error effort.

Thanks for your input!