"Bubble Scanner 1"
Bubble[] b = new Bubble[300]; void setup() { size(1920, 1080); for (int i = 0; i < b.length; i++) { b[i] = new Bubble(random(30,64)); } } void draw () { background(random(100,250),random(100,250),100); for (int i = 0; i < b.length; i++) { b[i].ascend(); b[i].display(); b[i].top(); } //For recording the screen //saveFrame("output/psych_bubbles_#######.png"); } //BUBBLE CLASS class Bubble { float x; float y; float diameter; float yspeed; Bubble(float tempD) { x = random(width); y = height; diameter = tempD; yspeed = random (0.25, 4); } void ascend() { y = y - yspeed; x = x + random (-2, 2); } void display() { ellipse(x, y, diameter, diameter); fill(100,random(100,250),random(100,250),80); strokeWeight(random(0, 1)); } void top() { if (y < -diameter) { y = height + diameter; } } }