float x = 0; float y = 0; float s = 30; void setup() { size(800, 800); background(255); fill(0); smooth(); rectMode(CENTER); noStroke(); } void draw() { drawThing(x, y, s); x += 50; if (x > width) { x = 0; y += 50; } } void drawThing(float x, float y, float s) { fill(0); rect(x, y, s, s); fill(255); s = s * random(0.5, 1); //s = s * 0.8; rect(x, y, s, s); fill(0); s = s * 0.8; rect(x, y, s, s); }