ArrayList Bricks = new ArrayList(); Background bg; class Brick{ float x, y, w, h; float r, g, b, a; float life, birth; float weight; Brick() { x = random(0, width); y = random(0, height); w = random(1,width/2); h = random(1,height/2); weight = (w * h) / 1000; if(weight < 5 ) weight = 5; r = random(0,255); g = random(0,255); b = random(0,255); a = random(0,255); birth = life = random(500, 1000); } void updatePos() { float dx = mouseX - x - (w/2); if(abs(dx) > 1) { x = x + dx/weight; } float dy = mouseY - y - (h/2); if(abs(dy) > 1) { y = y + dy/weight; } // x = x - (w/2); // y = y - (h/2); } void update() { --life; } void render() { strokeWeight(5); stroke(0, (life/birth)*255); fill(r,g,b, (life/birth)*a); rect(x, y, w, h); } boolean isDead() { if( a <= 0 ) return true; return false; } } class Background { float r, g, b; float step; Background() { r = random(200, 255); g = random(200, 255); b = random(200, 255); step = 2; } void update() { r += random(-step, step); g += random(-step, step); b += random(-step, step); } void render() { background(r, g, b); } } void setup() { size(400, 400); frameRate(30); Bricks.add(new Brick()); bg = new Background(); } void draw() { // Render our background bg.render(); // Render our bricks for(int i = 0; i