Visualizations
296 / 500

296 · Astronomy

Antikythera Mechanism

The 2,000-year-old Greek computer, every gear meshing, scrubbing across centuries.

Thirty-five bronze gears with the tooth counts reconstructed from X-ray scans of the fragments: one turn of the 224-tooth main wheel is a year, 64/38 x 48/24 x 127/32 gives the 254 sidereal months of 19 years, and a pin on k1 pushing a slot in the offset k2, riding on the 223-tooth platform, speeds the Moon up and slows it down by about 6 degrees each anomalistic month. Every spur gear has true involute teeth, and each gear's angle comes from its driver through a phase-matched mesh formula, so teeth stay in their partners' gaps at any date. The front dial shows the Sun, the Moon and its phase ball against the zodiac and the Egyptian calendar; the back spirals count the 235 months of the Metonic cycle, Olympiads, and the 223 months of the Saros, whose eclipse glyphs are predicted from mean lunar elements starting in 205 BC.

Try it. Drag sideways on the gears to scrub through time (further is faster), drag the date ruler to jump across centuries, or turn the crank knob on the left. Hover a gear for a magnifier and its tooth count. E toggles the exploded view, arrow keys step a month or a year (with Shift), up and down change speed, R returns to the epoch, Space pauses.

  • Involute gear geometry
  • Phase-matched gear meshing
  • Pin-and-slot epicycle
  • Oblique layered projection

View the source · one module, plus a small shared runtime for sizing, the animation loop and input

Build your own

Paste this into Claude Code, Codex or any coding agent to get a simple version running, then take it wherever you like.

Build a working model of the Antikythera mechanism, the ancient Greek astronomical computer, with JavaScript and the HTML canvas element. Put everything in a single index.html file with no libraries or build step, so I can open it directly in a browser.

Start simple:
- Make a canvas that fills the window, stays sharp on high-DPI screens (scale by devicePixelRatio), and resizes with the window. Paint a dark background.
- Write a function that builds an involute spur gear as a Path2D (pitch radius m * N / 2, 20 degree pressure angle, tip one module out, root 1.25 modules in) and fill it with a bronze radial gradient.
- Lay out just the lunar train: a 224-tooth wheel turning once a year, driving 64/38, 48/24 and 127/32, each pair exactly m * (N1 + N2) / 2 apart.
- Keep a date in days. Set the big wheel's angle from it, then derive every other gear from its driver: angleB = theta + PI - PI / NB + (theta - angleA) * NA / NB, where theta is the angle of the line from A's centre to B's. Teeth then always face gaps.
- Draw a front dial with the Sun pointer (the year wheel) and the Moon pointer (the end of the train), and print the date. Advance time with requestAnimationFrame.

Once that works, make it beautiful:
- Add a conic-gradient sheen that stays fixed toward the light as gears turn, bevelled edges, spoke windows and soft offset shadows.
- Add the pin-and-slot: two 50-tooth gears with slightly offset axes, one pushing a pin along a slot in the other, so the Moon runs fast and slow each month.
- Let me drag to scrub through time and show the Moon's phase as a half-dark ball.

Explain the key ideas in short code comments. When you're done, tell me how to open it and suggest three directions I could take it next, such as the back-dial Metonic and Saros spirals with eclipse predictions, an exploded 3D-ish view of the gear layers, or a magnifier that shows the teeth meshing.
PreviousFireworksShells arc, burst and crackle with glowing, fading sparks. NextBlacksmith's ForgeHeat, hammer and quench a steel bar whose glow and temper colors come from physics.

Related visualizations

  • Gear Train WorkshopPhysics A blueprint bench where involute gears snap into mesh, drive clocks and jam.
  • Watch MovementPhysics An exploded mechanical watch whose Swiss lever escapement is simulated, not animated.
  • AnalemmaAstronomy A garden noon mark traces the figure eight of Earth's orbit, one stud a day.
  • Tide MachineMath A brass Kelvin tide predictor sums ten cosines with one wire and a pen.
  • Kirkwood GapsAstronomy Thousands of asteroids and Jupiter's resonances carving gaps into a featureless belt.
  • RingmakerAstronomy Backlit planetary rings with shepherd moons, wavy gap edges, propellers and waves.
  • Foucault PendulumPhysics A museum pendulum ploughs a rosette into sand as the Earth turns beneath it.
  • Retrograde LoopsAstronomy Why Mars backs up against the stars, drawn by Copernicus and Ptolemy side by side.
  • Orbital ResonanceAstronomy A seven-planet resonant chain that chimes on every transit and weaves its own spirograph.

Use ← and → to move between demos. While the canvas has focus, keys go to the demo instead.

← More from Emergent Mind Labs