Codebox Software

Gravity Simulator

Published:

This is a 2-dimensional gravity simulation written in JavaScript. Particles are initialised with randomly selected mass, position and velocity and their subsequent movement is determined by Newton's Law of Gravitation.

Particles can bounce off the sides of the container, and will join together into larger bodies when they collide. The simulation will restart with different parameters when only a single particle remains.