Object-Oriented Programming (OOP) centers around the idea of “objects,” which are instances of classes. A class is a template for creating objects and defines their characteristics and behaviors. Objects can interact with one another through their methods, which are functions defined within the class. With OOP, classes can use methods from other classes and reuse code. OOP also provides a natural way to represent concepts in code and go from very simple data structures to intricate ones.
In my code, the particle class included
position
velocity
radius
color
speed
points
outerRadius
innerRadius
The methods included were:
display()
endShape()
update()
checkBounds()
I drew the particle as start shapes with random size and color and with draw()
function it simulates the effect of particles falling down the canvas. checkBounds()
method also ensures that the particles loop back to the top of the canvas when they reach the bottom. This creates a continuous falling effect
p5 link: https://editor.p5js.org/ssc10042/full/H0-uDZhIJ