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.
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.