Home▸Electromagnetism▸Magnetism (2D)

🧲 Magnetism (2D)

Top-down Canvas2D magnetism lab: drag bar magnets and a compass over a bed of iron filings, add a second magnet, and watch dipole field lines and filing alignment respond live.

Electromagnetism2DModerate60 FPS📱 Mobile-adapted⇄ 3D version
2d-magnetism-simulation ↗ Open standalone

This 2D companion models each bar magnet as a pair of point poles and sums their inverse-square contributions the same way the 3D original does, just evaluated in a flat plane you can drag things across: bar magnets and a compass respond to mouse or touch, iron filings scattered across the field rotate to trace out the dipole shape, and adding a second magnet lets you see attraction and repulsion — plus the force between them — depending on which poles face each other.

⚙ Under the hood

2D top-down magnetism lab: drag bar magnets and a compass over a bed of iron filings, add a second magnet, and watch dipole field lines and filing alignment respond live.

Canvas 2DElectromagnetismMagnetic DipoleField LinesCompass

2D · HTML5 Canvas 2D · 60 FPS target · runs fully client-side, no install

What did you find?

Add reproduction steps (optional)