Interpolating

Interpolation is used when we have some variable that we want to go from an initial value to an ending value in a certain amount of time.

Our variables are:

(Assume that t is in the range 0 <= t <= duration.)

t / duration will be a fraction between 0 and 1, indicating how far along we are in the interpolation.

Then, using a linear interpolation, the current value for X will be:

	a = t / duration
	X = (1 - a) * start + a * end

A slow-in, slow-out interpolation can be done by the this formula:

	a = t / duration
	a2 = -2*a*a*a + 3*a*a
	X = (1 - a2) * start + a2 * end


Last modified 7 March 2000.
Dave Pape, pape@evl.uic.edu