importNumericdefsmooth_interpolate(start,stop,seconds,fps=30):""" Given a start and stop vector (2 or 3 element tuple), and a time period at a default 30 fps, yield a sequence of vectors which smoothly interpolate between stop and start. """start=Numeric.array(start,Numeric.Float)stop=Numeric.array(stop,Numeric.Float)diff=stop-startinc=1.0/fpsstep=diff*inccurrent=Numeric.array(start)current_second=incwhilecurrent_second&lt;seconds:percent=((seconds-current_second))/secondsstep=diff*(1.0-(percent*percent*(3.0-percent*2.0)))yieldtuple(start+step)current_second+=incyieldtuple(stop)

page migrated to new wiki
Comments
Line 13 shares the same problem as the LinearInterpolator.
I had to factor in a fairly large denominator to make the step function
on line 18 give me values in the proper range.
The step function produces some pretty movement, but it is not caller-modifiable.
My Interpolator class gives a fairly similar movement with shape=2.2 and middle=1.0.
--23 April 2007 Duoas