Mobile Version

Jeremy Nally's Mathematics Tutorials

Gravity and Collision Simulator in JavaScript

Here is the refactored and modified version of my gravity simulator. Click in the canvas to place random circles. Adjust sliders to change the strength of gravity and modify the elasticity of the collisions. The mass, speed, and radius sliders affect the maximum randomly generated values. The checkboxes can be used to turn on trails, collisions, or the walls. Gravity is turned off when its slider is moved all the way to the left.

Future plans include using a form to generate customized systems and having prebuilt systems to demonstrate various kinds of physics. Examples include a solar system, a pool table (requires further additions to physics in simulation), and various examples from the kinetic theory of gasses.

Rendering Time Interval: Background Color:

Elasticity: Gravity:

Mass: Radius:

Speed: dt:

Trails: Wall Bounce: Collisions:

This feature requires a modern web browser.