Spirograph

The Spirograph applet is written using Java. You must turn on Java or have a Java-enabled browser such as Firefox or Microsoft IE to see this applet.

You can display this spirograph on your own web page. See below.


What is a Spirograph?

A Spirograph is a curve formed by rolling a circle inside or outside of another circle. The pen is placed at any point on the rolling circle. If the radius of fixed circle is R, the radius of moving circle is r, and the offset of the pen point in the moving circle is O, then the equations of the resulting curve is defined by:

x = (R+r)*cos(t) - O*cos(((R+r)/r)*t)
y = (R+r)*sin(t) - O*sin(((R+r)/r)*t)
(moving circle outside the fixed circle)

x = (R-r)*cos(t) + O*cos(((R-r)/r)*t)
y = (R-r)*sin(t) - O*sin(((R-r)/r)*t)
(moving circle inside the fixed circle)


How to use it?

Here is how you can use the controls in this Spirograph applet:


How to put this applet on your web page?

Embed following HTML code in your web page. That's all! Feel free to change the initial values of the radii in the code below.

<applet codebase="https://wordsmith.org/anu/java/" archive="Spiro.jar" code="Spiro.class" width=680 height=400>
<param name="R" VALUE="81">
<param name="smallr" VALUE="2">
<param name="O" VALUE="71">
<param name="movingCircleOut" VALUE="false">
<param name="redBits" VALUE="242">
<param name="greenBits" VALUE="255">
<param name="blueBits" VALUE="139">
<param name="colorMode" VALUE="multi">
</applet>
<br>
Created by <A HREF="https://wordsmith.org/anu/">Anu </A>
<a href="https://wordsmith.org/anu/">Garg</A>.
<p>


I have suggestions for improving this applet?

Your comments are welcome at garg AT wordsmith.org. (replace AT with @)


Download

Compressed zip file with source, bytecode and all supporting files: spirograph.zip


Where can I buy the good old spirograph I can touch and hold?

If you'd rather have a spirograph made of atoms rather than bits, you can buy one at Amazon.com: try this or this.


Awards

SUG's Java SIG: Cool Applet of the Week

Gamelan: What's Cool


Anu Garg