/* built with Studio Sketchpad: * https://sketchpad.cc * * observe the evolution of this sketch: * https://studio.sketchpad.cc/sp/pad/view/ro.Wbte71-y1U8/rev.4 * * authors: * GoToLoop * license (unless otherwise specified): * creative commons attribution-share alike 3.0 license. * https://creativecommons.org/licenses/by-sa/3.0/ */ /** * Falling Balloons (v2.0) * by aimee12345 & DCRaven (2014/Mar) * mod GoToLoop * * forum.processing.org/two/discussion/3945/arrays-loops-processing * * studio.processingtogether.com/sp/pad/export/ro.98wJk9FLLhbUE/latest */ static final color BG = #3232FA, FG = #20FC35; static final int NUM_BALLOONS = 10, MIN_SIZE = 75, MAX_SIZE = 125; final PVector[] balloons = new PVector[NUM_BALLOONS]; void setup() { size(600, 600); frameRate(60); smooth(4); ellipseMode(CENTER); stroke(0); strokeWeight(2); fill(FG); for (int i = 0; i != NUM_BALLOONS; balloons[i++] = new PVector( random(width), random(height), random(MIN_SIZE, MAX_SIZE))); } void draw() { background(BG); for (PVector b: balloons) { ellipse(b.x, b.y, b.z, b.z); if (++b.y > height + b.z) b.y = -b.z; } }