WP2WS – W02 – Galaxy and Shooting Stars

For this week’s assignment, we were asked to develop generative visuals using OOP, Vector and Forces concept. So I choose to follow the idea that I had for last week’s assignment and simulate the visuals and concept of the galaxy. After searching for inspirations, I found this particularly interesting project that fits my initial idea. So I decided to create a similar generative visual based on this project. 

For the concept development, as I just mentioned, I want to simulate a galaxy. So the visual may contain a central planet like the sun and several surrounding planets moving in a circular motion around the central one. The user interaction can be users clicking the mouse and shooting out new stars surrounding the central planet. Those new stars can also be treated as man-made satellites launched by human.

First, I utilized the OOP to create a class for the planets. Following the instructions from Professor Moon during the class, I determined two kinds of objects using the same class. I used “ballA” for those surrounding planets, and “ballB” for the central one. Then I used the vector to control the position, velocity and acceleration of those planets. I also applied the force from the outside of the class so that it can be easily manipulated and generate different visual effects.

Besides, I also added user interaction into it by applying the function mouseClicked(). Basically, when the user click the mouse on the canvas, it will automatically shoot out a small star from the mouse position which will be in a circular motion as other surrounding planets are. The final outcome looks like this:

 

Reference:

https://codepen.io/skoteh90/pen/BOdGjX

Leave a Reply

Your email address will not be published. Required fields are marked *