Home▸Space & Astronomy▸Celestial Body Dynamics: Gravity & Orbits (2D)

🪐 Celestial Body Dynamics: Gravity & Orbits (2D)

2D orbital-mechanics lab: a real inverse-square gravity integrator (RK4) drives one body around a central mass — set the mass, starting distance and launch speed and watch circular, elliptical, parabolic or hyperbolic orbits emerge from the same formula, with live energy and eccentricity readouts.

Space & Astronomy2DModerate60 FPS📱 Mobile-adapted⇄ 3D version
Celestial Body Dynamics: Gravity & Orbits (2D) ↗ Open standalone

This 2D companion strips the 3D scene down to the actual physics behind orbital motion: a single body orbits a fixed central mass under Newtonian gravity, stepped forward with a 4th-order Runge–Kutta integrator so total energy stays nearly constant instead of drifting. Sliders set the central mass, the starting distance and the launch speed as a multiple of the local circular speed — launch at exactly that speed and the path closes into a circle, launch slower or faster and it stretches into an ellipse, and past √2 times circular speed the body escapes on a parabolic or hyperbolic path, all read live off the same eccentricity and energy formulas that describe real orbits.

⚙ Under the hood

A 2D canvas simulation of one body orbiting a fixed central mass under real inverse-square gravity, integrated with RK4.

orbital mechanicsnewtonian gravitykepler orbitseccentricityrunge-kuttaenergy conservation

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

What did you find?

Add reproduction steps (optional)