“I walked in universes where the laws of physics were devised by the mind of a mad man.”
The following is an assortment of P5.JS sketches (JavaScript programs that manipulate HTML5 Canvas) I have coded from time to time. They involve coding up a small physics engine with friction, gravity and other forces.
Each of the following programs employ a "Mover" class, which has information in vector form such as the object's location, velocity and acceleration. Other than methods to display and move the objects in the canvas, the Mover class also has an "applyForce( )" method, which enables the objects to experience any force in vector form. Afterwards, multiple objects were generated using JavaScript arrays.
Made with by Apurba