int brickWidth = 40; int brickHeight = 40; int cols = 15; int rows = 15; int columnOffset = 60; int rowOffset = 60; float rotationIncrement = 0.15; void setup() { size(800, 800); background(255); smooth(); fill(1) ; stroke(0); noLoop(); } void draw() { translate(30, 30); for (int i=0; i<cols; i++) { pushMatrix(); translate(i * columnOffset, 0); float r = random(-QUARTER_PI, QUARTER_PI); int dir = 1; for (int j=0; j<rows; j++) { pushMatrix(); translate(0, rowOffset * j); rotate(r); rect(-brickWidth/2, -brickHeight/2, brickWidth, brickHeight); popMatrix(); r += dir * rotationIncrement; if (r > QUARTER_PI || r < -QUARTER_PI) dir *= -1; } popMatrix(); } }