Archive for January, 2007

Bumpslide Library 0.9.4 Released

Tuesday, January 30th, 2007

I’ve created a new package of my AS2 libraries over on SourceForge.

http://bumpslide.sourceforge.net/

The latest release has been labeled 0.9.4, as I have updated things to work with the latest version of the ASAP Framework. Numerous bug fixes are here as well as general day-to-day improvements across all the utilities.

Unexpected Results - Interpolating Sine

Thursday, January 18th, 2007

interpol_sine_th.gif

Demo: Interpolating Points on a Sine Curve
Source: interpolate_sine.zip

A recent post on the gotoAndPlay.net flashlist asked about charting the sine wave in flash using the drawing API. The problem with the drawing API is that the quadratic bezier curveTo functions don’t make for the smoothest curves without a little trickery.

Patrick Mineault has a great piece on his blog about piecewise cubic beziers. Using his code, we can interpolate between the points on a sine curve quite smoothly. I thought his demo was quite nice, so I download his source, hacked it a bit, and came up with this demo.

Yes, it makes a nice smooth curve, if that’s what you’re after, but the fun starts when you start playing with the controls. A good place to start is by setting the wavelength to 2 while increasing the overshoot. Once the wavelength gets below 4 pixels, the cubic bezier interpolation no longer has enough points to interpolate the high frequency wave accurately. Increasing the overshoot factor creates some unexpectedly fun curls. Altering the number of points plotted gives us even more variation.

Screenshot 1

Screenshot 2

Screenshot 3

Screenshot 4