The code is base on my second week’s assignment.
We used a potentiometer and a pressure sensor which I made at soft lab as analog input, and changed the color of the background by the map function.
About constructor function:
My codes are here.
Little bubbles and rectangles are making with array function.
The “bubbles.js” includes all constructor functions, and the “sketch.js” has the code in draw() that only makes calls to objects.
The big circle in the middle will change color depending on whether the green bubbles or the red rectangles hit it.
After hitting the big circle, the little bubbles and rectangles will change to white color and disappear gradually.