Gravity Wells (2D): Multi-Body Potential Field
A 2D companion to the 3D gravity-wells lab: real Newtonian inverse-square gravity from several drifting point masses, a swarm of orbiting particles, and a live gravitational-potential heatmap standing in for the 3D grid's curved sheet.
This 2D companion runs the same Newtonian gravity as the 3D version — a genuine inverse-square-law force sum over several point masses, not a decorative stand-in — through a flat top-down canvas built for reading the field rather than orbiting a rendered scene. Each well drifts slowly on its own orbit; a swarm of particles is integrated every frame with symplectic (semi-implicit) Euler under the combined pull of every well, so particles trace looping, precessing and occasionally ejected paths exactly as an unstable multi-body system would rather than a single clean ellipse. Underneath it all, a coarse gravitational-potential field Φ(x,y) = −ΣGmᵢ/rᵢ is recomputed and rendered as a live heatmap, darkening and bluing wherever the combined pull is strongest — the 2D stand-in for the 3D lab's dipping grid mesh. A particle that strays inside a well's capture radius, or drifts off the visible domain, is counted as captured and respawned on a fresh orbit so the swarm never runs dry.
2D multi-body gravity lab: real inverse-square-law forces from several drifting point masses, symplectic-Euler particle integration, a live gravitational-potential heatmap, and running capture/elapsed-time/mean-speed readouts.
2D · HTML5 Canvas 2D · 60 FPS target · runs fully client-side, no install
FAQ
Each particle starts on a rough circular-orbit speed around one nearby well, but every other well also pulls on it at the same time. That combined multi-body force perturbs the path into precessing loops, rosettes, or — if a particle passes close to a second well — a sudden ejection, which is the expected behavior of a real N-body gravitational system rather than an idealized two-body orbit.
It's the gravitational potential Φ(x,y) = −ΣGmᵢ/rᵢ evaluated on a coarse grid and recolored every few frames — darker, more saturated blue means a deeper (more negative) potential well. It's the same physical quantity the 3D version visualizes as a dipping mesh, just rendered as color instead of height.
Identical underlying Newtonian gravity and the same capture/respawn rule — this page trades the orbiting 3D curved-grid render for a flat, always-fully-visible 2D view with a dedicated potential-field heatmap and live capture/speed statistics.