Visualizations
094 / 500

094 · Physics

Foucault Pendulum

A museum pendulum ploughs a rosette into sand as the Earth turns beneath it.

Seen from the balcony, a brass bob swings over a bed of sand while the floor turns with the Earth. In that rotating frame the bob feels a Coriolis force from the vertical part of Earth's spin, Omega sin(latitude), so the plane of the swing turns clockwise in the north, counterclockwise in the south, and not at all on the equator. The motion is integrated with RK4, and a gentle driver keeps the amplitude up like the electromagnet under a real museum pendulum. A stylus carves each pass into a height field that is relit from a low angle every frame, so the grooves read as real relief, and the bob knocks over the ring of pegs one by one. Earth's spin is sped up about 70 times relative to the swing so a whole day's flower stays legible.

Try it. Drag the bob to pull it back and let go, flicking sideways for an elliptical orbit. Drag up or down on the globe to choose a latitude, and use the plus and minus buttons to change the speed. Click the view, then press 1 to 8 for famous places, the up and down arrows to step the latitude, D to switch the driver, space to release from rest, or C to rake the sand.

  • Coriolis force in a rotating frame
  • RK4 integration
  • Height field relief lighting
  • Orthographic globe

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 Foucault pendulum drawing in sand, seen from above, 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.
- Simulate the bob's horizontal position (x, y) in the rotating frame of the floor: acceleration = -w0^2 * position plus the Coriolis term (2 W vy, -2 W vx), where W = Omega * sin(latitude). Integrate with RK4 in small steps.
- Real pendulums swing thousands of times a day, so speed Earth's spin up (say one day = 70 swings) and say so on screen.
- Draw a round sand bed and the bob as a shaded circle with a thin wire toward the centre. Leave the bob's path behind as a thin dark line on an offscreen canvas.
- Add a latitude slider and show the predicted turn rate, 15 degrees per hour times sin(latitude).

Once that works, make it beautiful:
- Turn the sand into a height field: the stylus carves a groove and heaps a little sand beside it, and every frame you light it from a low angle using normals from neighbouring heights, so it looks like real relief.
- Add a ring of pegs that the bob knocks over as the plane turns, a brass rim and a compass ring around the bed.
- Draw a small globe that spins with the simulated time and marks your latitude.

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 letting friction spiral the pattern inward, comparing the north and south hemispheres side by side, or adding the full spherical pendulum's own precession for elliptical swings.
PreviousInvented AtlasA parchment map of a world that never was, with rivers, realms and its own language. NextRoot BraidsLoop a quintic's coefficients and its roots braid, swap and refuse to come home.

Related visualizations

  • Magnetic PendulumFractals A pendulum over three magnets, and the fractal map of where every release point ends up.
  • HarmonographGenerative art A Victorian pendulum machine inks decaying roses and stars onto cream paper.
  • Double PendulumPhysics Pendulums that start almost identical and end up worlds apart.
  • AnalemmaAstronomy A garden noon mark traces the figure eight of Earth's orbit, one stud a day.
  • Chladni PlateSound Sand dances into Chladni figures on a brass plate whose modes come from the Ritz method.
  • Magnetic BottlePhysics Particles gyrate, bounce and drift in Earth's dipole, filling the radiation belts.
  • Watch MovementPhysics An exploded mechanical watch whose Swiss lever escapement is simulated, not animated.
  • Lagrange LandscapePhysics The restricted three-body problem as a plaster relief, Trojans looping on its summits.
  • Sound of MandelbrotFractals Hover the Mandelbrot set to see and hear orbits: each bulb's period plays as a loop.

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

← More from Emergent Mind Labs