Daniel Litvak

Engineer & Developer

/ Back to portfoliop5.jsPhysics simOrbit prediction

2D Gravity Simulation

Interactive Newtonian sandbox that lets you spawn bodies, pan the origin, and watch how gravity shapes their orbits. Field vectors, velocity indicators, and long-range predictions make the dynamics easy to read at a glance.

Description

  • Implements Newton's law of gravitation across movable bodies while handling reaction forces on anchored masses.
  • Predicts the next 1000 simulation ticks and renders blue trajectory trails so you can spot stable orbits versus escapes.
  • Draws a low-detail gravitational vector field to reveal how nearby accelerations bend space around heavy bodies.

Controls

Click to insert a new gravity object.

Drag to pan the origin and explore the field.

R randomizes current object positions and velocities.