Learn creative coding writing simple programs

112. Array of objects: hypnotic animation part I

This episode is split in two parts. Our goal is to create an array of animated objects. We will create a few hundred pulsating circles.

In the first part of this episode we create two files: a very simple main program, and a class file where we define Bug, our animated circle. The size of this circle will increase and decrease regularly. Each of our bugs will have six properties: the horizontal and vertical position, the current size, the maximum and minimum size, and the "growth direction": a value that indicates how much the circle grows or shrinks on each frame. If that value is positive, it means the circle is getting bigger. If it's negative, the circle is becoming smaller. If you have a number, and add a negative number to it, the resulting number is always smaller. That's how the circle shrinks. For instance, assume the circle has size 20. If you add -1 to it, you get 19. Add -1 again and you get 18. I hope you get the idea.

Tags: array, objects

Code editor

You can make changes to the code below. Then

Questions and comments

Try to stay close to the topic of this episode. Use the Processing forums for help with unrelated Processing projects (or hire me for help ;-)

To indicate that a word in your comment is code, use the `backtick`. Example
Do `float` and `int` smell similar?
To highlight code blocks, surround it with ``` code-fences ``` like this:
``` void setup() { size(600, 600); } ```