Visualizations
282 / 500

282 · Physics

Bubble Chamber

Archival film of particle tracks: tightening spirals, V decays and pairs.

Two metres of superheated liquid sit in a magnetic field, and every charged particle is stepped along its path with the Lorentz force, bending on a circle of radius p / 0.3qB while it loses energy at the Bethe-Bloch rate. Losing momentum shrinks the radius, so electrons wind into tightening spirals and slow protons leave short, dense stubs, and bubbles are stippled along each path more thickly where ionization is high. A beam pion knocks out delta-ray electrons, then smashes into a nucleus to spray pions, protons and photons; photons convert into electron-positron pairs that curl in opposite directions, invisible lambdas and kaons fly a few centimetres before decaying into V-shaped pairs, and a stopping positive pion decays into a muon and then a positron. Each event is stored as a seed, so changing the field re-simulates the whole photograph at once.

Try it. Click to fire a beam pion that interacts where you clicked, and Shift-click or press Space for a photon converting into a pair. Drag the field slider or use the arrow keys to curl or straighten every track live, 0 switches the field off, F reverses it, and Enter advances the film.

  • Lorentz force tracking
  • Bethe-Bloch energy loss
  • Relativistic two-body decays
  • Procedural film grain

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 bubble chamber simulation that looks like an old black and white photograph of particle tracks, 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, and resizes with the window. Let the picture be 2 metres wide and paint it a dark warm gray.
- Track a charged particle in a magnetic field B perpendicular to the screen: each small step of a few millimetres, turn its direction by step * 0.3 * q * B / p (p in GeV/c, B in tesla), then move forward.
- Add energy loss: subtract about 0.3 MeV per centimetre times 1 / beta^2 from the energy E = sqrt(p^2 + m^2), recompute p, and stop the track when it runs out. Electrons then wind into tightening spirals.
- Instead of drawing a line, drop small white dots (bubbles) along the path with random spacing, closer together when 1 / beta^2 is large.
- Fire a fast pion from the left edge every couple of seconds. Where you click, make it hit a nucleus and spray out several pions of both charges with random momenta.

Once that works, make it beautiful:
- Add a film look: coarse grain, uneven illumination, vignetting, fiducial crosses and a printed frame number.
- Add delta rays (small electron spirals knocked off fast tracks) and photons that convert into an electron-positron pair curling in opposite directions.
- Store each event as a random seed and re-simulate everything when a magnetic field slider moves, so all the spirals wind and unwind live.

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 neutral particles decaying into V shapes, the pion to muon to electron decay chain, or a film advance between exposures.
PreviousSeam CarvingContent-aware resizing: seams peel away and the lighthouse stays intact. NextFlow FieldThousands of particles ride an evolving noise field into silky trails.

Related visualizations

  • Magnetic BottlePhysics Particles gyrate, bounce and drift in Earth's dipole, filling the radiation belts.
  • Soap FilmFluids A draining soap film swirls with true thin-film colors until it turns black and pops.
  • Quantum BilliardsPhysics A quantum wave packet bounces around chaotic billiards and leaves scars.
  • Radiating ChargePhysics Shake an electric charge and watch light peel off its field lines at c.
  • Bloch SpherePhysics A qubit on the Bloch sphere: gates, Rabi flips, decoherence and a spin echo.
  • FoamEmergence Soap foam coarsens under von Neumann's exact law, with live T1 swaps and vanishing cells.
  • CRT MonitorRetro An emulated electron beam, decaying phosphors and a shadow mask, under a 7x loupe.
  • Dynamical BilliardsPhysics A fan of 1,000 balls in reshapable tables, linked live to the Birkhoff phase map.
  • Chrome Blob3D A wobbling liquid metal droplet with real reflections, rasterized by hand.

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

← More from Emergent Mind Labs