Every planet's position is solved directly from Kepler's laws instead of a fixed angular increment. Each frame, the mean anomaly grows linearly with time — M = 2π·t/T — then Kepler's equation M = E − e·sin(E) is solved for the eccentric anomaly E with 6 iterations of Newton–Raphson. The orbit position follows directly: x = a(cos E − e), y = b·sin E with b = a√(1 − e²), which places the Sun exactly at the ellipse's focus, so planets visibly speed up at perihelion and slow at aphelion (Kepler's second law — equal areas in equal times) instead of moving at constant angular speed.
M(t) = 2π·t / T
M = E − e·sin(E) (solved via Newton-Raphson)
x = a(cos E − e), y = a√(1−e²)·sin E
v = v_circ · √(2a/r − 1) (vis-viva equation)
The Sun-mass slider changes orbital periods via Kepler's third law: T = T₀/√M — doubling the Sun's mass makes every planet complete its orbit √2× faster at the same distance, since gravity (and hence orbital speed) scales with √(GM). The speed readout uses the vis-viva equation, which is why it rises visibly as a planet swings through perihelion on an eccentric orbit.
- Track planet — recentres the camera on a chosen planet and reports its live period and speed.
- Click empty space — launches a comet on an inbound radial trajectory.