What to do
Drag the bar magnet to move it. Press and hold the empty plate to lower a strong magnetic wand there, and drag it around. A quick tap on the plate shakes it, and the filings hop into crisp lines.
Bring the wand to the red north end and the filings bridge across in arches. At the grey south end they leave a clean gap. Double-tap the magnet to flip it.
How the field works
Each pole is a point source of field. Every filing turns to lie along the field where it is strong enough to beat friction, stands up where the field points steeply into a pole, and slides slowly sideways onto the nearest field line, so chains form.
A tap sends a ring of vibration across the plate. Where it passes, friction drops for a moment, so even filings in a weak field line up.
How it is drawn
Tens of thousands of filings live in a GPU texture that is updated every frame. Each is drawn as a thin strip that catches a low raking light like a strand of hair, so filings glint as they turn.
Their shadows are drawn into a small offscreen image that darkens the plate under clusters, and the magnets cast soft shadows computed straight from their shape.