Assignment 3 – OOP Generative Art

In this assignment, I decided to create an abstract form of art. I started off with generating a dynamic art piece featuring circles that appear and disappear from the screen over time. To make them appear prettier, I made them multi-colored, translucent, removed their stroke, and gave them different sizes. To give the circles these characteristics, I made a separate circle class to continuously generate more circles and then start to delete them once their number reached greater than a hundred.

Once the basic step was achieved, I wanted to make the canvas and art more interactive. I decided to make the circles bounce off the edges of the canvas when the space bar is pressed while the initial effect is still maintained. To do this, I made a move function in the circle class which is activated when the Space Bar is pressed. This effect was achieved by reversing the speed when the circles touch the edge. However, it took me a while to refine the if condition to ensure the bouncing effect was clearly understandable.

The circles start off randomly placed on the canvas and move and bounce off the edges when the space bar is pressed. When the mouse is clicked, all the circles form a line and start to spin around the center of the canvas. The swirling motion of the circles and the changing colors could represent a tornado or a whirlwind, creating an abstract and mesmerizing image. As we discussed chaos and randomness in class, I wanted to create an art piece which had both these elements. The dynamic motion of the circles creates a sense of chaos and unpredictability, while the synchronized spinning adds a touch of order and harmony.


One challenging aspect of this code is the mathematical calculation involved in the spinAround method. This method uses trigonometry to update the position of the circle based on its angle, ensuring that it spins smoothly around the center of the canvas. After trying multiple different way of making the circles spin, with the help of this formula that I found online, I was able to achieve the spinning effect. Keeping track of the angle, position, and movement of each individual circle is also a challenge, but the use of classes and arrays helped to solve this problem. I really enjoyed making this art piece and therefore kept adding more interactivity to better understand these fundamentals.

Leave a Reply