The Java code

Some interesting values

Here is a silly java spirograph applet.

About the funnest thing you can do here is hold down your mouse button within the image to the left and drag it up and down. If you are a bit more daring, you can also create a new image by changeing the values of A or B by typing a new number into either of the white boxes above the image followed by the enter key.

A spirograph can be thought of as two circles, one rolling around inside the other. The image is created by picking a point on the inside circle and following it as it spins within the outer circle. A real spirograph makes smooth curves. If you want to see that sort of thing choose small numbers (eg .05-.3) for A and B and make one of the values negative.

The values of A and B are radians of rotation, per iteration for the inside and outside circles respectively. Dragging the mouse up and down increases or decreases the radius of circle A. The radius of circle B is increased or decreased accordingly to keep the image a constant size.