This simulates the gravitational attraction between multiple bodies. It runs entirely in the browser.
With the default settings it simulates the orbits of the inner planets, i.e. Mercury, Venus, Earth and Mars, around the Sun. It is possible to modify the attributes of these planets (initial speed, direction, mass and location), as well as to introduce new objects.
Follow this link https://rsdc2.github.io/laws-of-motion/.
- Install
http-server
for serving the code locally.
npm install
- Serve locally:
npx http-server
- Load in browser:
e.g.
http://localhost:8080
- To modify initial parameters for the objects, click
Modify initial parameters
, and change the details in the appropriate cells of the table. - To reset to initial settings, click
Reset
. - To pause the simulation, click
Pause
. - To restart the simulation, clikc
Start
.
The only dependency is http-server
(MIT license) for serving the code locally.