Phony Physics (a.k.a. Fun with Interpolation) April 3rd, 2009
Patrick Stein

In a previous post, I mentioned looking for a polynomial for an application. I am working on an application that involves clicking or dragging tiles around. Once you release the tile, I want it to snap to where it’s supposed to be.

The easiest way to do this is to just warp it to where it’s supposed to go. This isn’t very visually pleasing. The next best thing is to set up a time-interval on which it moves into place. Then, linearly interpolate from where it is to where it’s going (here with t normalized to range between zero and one):

(1-t)x_0 + tx_1

That’s much better than just warping, but it doesn’t have any sort of fade-in or fade-out. It instantaneously has its maximum velocity and then instantaneously stops at the end.

Typically, then one uses a cubic spline to scale the t value before interpolating to get a speed up in the beginning and then slow down in the end.
Read the rest of this entry ⇒

Updates In Email

Email:

l