Chladni & Ferrofluid Sandbox: a million particles in one HTML file

Up to a million glowing particles on a dark square plate. Sweep the frequency and they settle into Chladni figures; hold the mouse down and a magnet pulls them into ferrofluid spikes. It is one 32,559-byte HTML file, and Claude Code wrote it with Claude Opus 5.5 from one prompt. The prompt and the file are free to download. Get the files

The file in Chrome on a MacBook Air M1, on WebGPU with 500K particles, recorded in real time with the page’s own sound (unmute to hear it). The slider and magnet moves come from a test script.

Try it live ↗Best in desktop Chrome. Not tested on a real phone yet.

  • 32,559bytes, one file
  • 1Mparticles max
  • 13plate modes
  • 1prompt
  • 22min, prompt to final file
  • 0external URLs

What’s in it

  • Chladni mode: a frequency slider from 80 to 2,000 Hz, with 13 standing-wave modes of a square plate along it. Near a mode the plate shakes hard and the particles move to its still lines. Between two modes the pattern blurs and morphs into the next one.
  • Ferrofluid mode: press and hold on the plate, and the pointer becomes a magnet. Particles pour in and stand up as a field of spikes in a hexagonal pattern. Let go and they slowly spread out again. The magnet works in Chladni mode too.
  • Live sound, made in the browser with the Web Audio API: a tone that follows the slider and gets louder near each mode, and a low hum while the magnet is on. It starts when you first touch the plate or press Sound.
  • 100K, 500K or 1M particles, or Auto, which starts at 500K and steps down if the frame rate stays under 30 fps.
  • Raw WebGPU with compute shaders, and a WebGL2 fallback that draws the same scene. Add ?gl to the address to force it.
  • Controls: Sweep, Scatter and a sound button, plus keys: 1 and 2 switch modes, S sweeps, R scatters, M mutes. On a phone, drag with a finger.

How it was made

  1. On 3 December 2026, Claude Code 2.1.328 ran with Claude Opus 5.5 (claude-opus-5-5) on my MacBook Air M1. The prompt came first and is saved as PROMPT.txt.
  2. Then the same session built index.html from that prompt. Nobody sent a follow-up. Claude tested the file, found three problems and fixed them itself (below).
  3. About 22 minutes passed from the saved prompt to the final file, including two test recordings.
  4. It was checked in Google Chrome on the same Mac, in a script-driven headless window: on WebGPU and on the forced WebGL2 path, at all three particle counts, and in a 390 px phone-sized view with touch.

Your result will not match mine exactly. The same prompt can give a different build on another run.

What didn’t work at first

  • The WebGL2 fallback didn’t compile. Some numbers went into the shader as whole numbers, and WebGL2 won’t multiply a decimal by a whole number. Writing every number with a decimal point fixed it.
  • In the first ferrofluid version the particles stuck in a ring at the edge and the middle stayed empty: the spike force was about 60 times too strong. After that fix they collapsed onto exact dots, a neat grid instead of a fluid. A soft inward pull, some random “heat” and taller spikes where the field is stronger made them look like spikes.
  • After a few modes every particle sat on one big X. All the modes shared the two diagonal still lines, so the particles gathered there and never left. Now every second mode is built without diagonal lines. The first test recording caught this.
  • One thing looked like a bug and wasn’t: in a hidden browser panel the animation paused, so the particles seemed to vanish. Testing moved to a headless Chrome window.

Good to know

  • In headless Chrome on the M1, all three particle counts ran at 60 fps on WebGPU, which is the browser’s frame cap. On WebGL2, 1M particles ran at 50–60 fps.
  • The link between frequency and modes is a simplified square-plate model, not a real, measured plate.
  • After ferrofluid mode, Chladni leaves the particles where the magnet left them. Press Scatter to start over.
  • On a phone-sized screen, the info box covers the top-left corner of the plate.
  • Not tested: the automatic switch to WebGL2 in a browser without WebGPU (only the forced ?gl), Firefox, Safari itself, or a real phone. The sound was checked from the recording, not by ear.

The files

The zip holds the index.html exactly as Claude wrote it. Unzip it and open index.html in Chrome; it runs offline. Free, no sign-up.

The idea, the prompt and the code are original: no other particle demo was used as a reference. Built by Claude Opus 5.5 in Claude Code. I run AI experiments and write them down: what worked, and what didn’t.

All free guides on this site