Sara Beheshti
← Back to Projects

Moving Balls

objects & classes in p5.js.

Balls are created by the class of Ball. They changes the sizes and also moves in x and y direction using Randomness. You can see the color chnages when the mouse is getting close to the ball and also when the mouse is pressed the balls start escaping the mouse.

When you press the "space" the gravity pulls the balls down and they bounce off the bottom wall till they stop. When pressing the "space", you will see Trump's face is attached to the mouse. (it's just an exploration practice)

View the code on GitHub