Spirographs in Flash

Submitted by joelmay on 24 August, 2005 - 8:19am.

Do you remember playing with a Spirograph when you were a kid? Did you ever go to one of those rock-music laser shows at the planetarium? (I think they went out of style in the mid 80's.) Those complicated-looking patterns can be described mathematically as parametric equations where x and y are sinusoidal functions of a parameter t.

Here's an example of the simplest spirograph, a circle:

x(t) = Axcos(2πt + φx)
y(t) = Aysin(2πt)

where

Amplitude: Ax = Ay = 40 pixels
Phase: φx = 0

Press play to vary the phase.

Now x(t) and y(t) have different frequencies:

x(t) = Axcos(2πfxt + φx)
y(t) = Aysin(2πfyt)

fx = 1/2 and fy = 1

Now 3x the period:

fx = 1/3
fy = 1

Now 3 against 4:

fx = 1/4
fy = 1/3

x(t) and y(t) are the sum of 2 sinusoids. Play varies A0 and A1

x(t) = A0cos(2πf0t) + A1cos(2πf1t)
y(t) = A0sin(2πf0t) + A1sin(2πf1t)

f0 = 1, f1 = 1/8

Same as above, but play varies the phase.

x(t) = A0cos(2πf0t+φx0) + A1cos(2πf1t+φx1)
y(t) = A0sin(2πf0t) + A1sin(2πf1t)

Now x(t) and y(t) are the product of 2 sinusoids. Play varies A0 and A1

x(t) = A0cos(2πt) * (A1cos(2πf1t)+C)
y(t) = A0sin(2πt) * (A1sin(2πf1t)+C)

f1 = 1/12, A1 + C = 1

Same as above but vary the phase.

I'll do more with these things later.