Particle World
Particle World
April 10th, 2025 by Isaac Cheaz
Prof: J.H. Moon
What is Object-Oriented Programming (OOP)?
Object-Oriented Programming is a style where you model real-world things as objects in your code. This means their behavior, properties and methods are based off of these real-world objects.
What is a Class and an Instance of the Class?
A class is like a blueprint or template for creating objects. Think of a class like the blueprint for a house. It doesnβt build the house, it just defines what a house should have (like walls, doors, and a roof). In code, a class defines what properties and methods an object should have.
When is OOP useful? In what way can it be utilized?
Object-Oriented Programming (OOP) is especially useful in projects that involve complex structures or repeating patterns, such as user accounts, products, or interactive components. It helps organize code by grouping related data and functions into objects, making the code easier to understand, maintain, and scale. OOP is particularly helpful in larger applications or team environments, where modularity and reusability are important. In JavaScript, itβs commonly used in web apps, games, and systems with dynamic, interactive behaviors.Β
my objects
The objects created in my code are variations of the Meteor class (blueprint/basis), with each representing an individual meteor falling across the screen. The meteors have properties such as the initial and updated x and y position, speedX and speedY, size, hue (color range), and previous positions prevX and prevY for drawing motion trails.Β
The methods I used include update(), which changes the meteor's position over time and resets it if it goes off-screen (y-pos dependent), and display(), which visually renders the meteor with a glowing head and trailing line (although not that visible). Manipulating these properties and methods makes the meteors give the illusion of real-world behaviors, falling at different speeds and angles with subtle glowing trails in order to create a dynamic meteor shower.