In this video, I demonstrate how to apply Newton’s Law of Universal Gravitation in p5.js using vectors and forces.
Wikipedia entry on Newton's law of universal gravitation
Link to chapter 2.9 of the Nature of Code book
Coding Train video on adding an acceleration vector to a Mover object
Coding challenge on attraction and repulsion forces
- Editing
by Mathieu Blanchette
- Animations
by Jason Heglund