xxxxxxxxxx
float r = 0; // rotation variable
void setup(){
size(500, 1000); // size of canvas
background(255); // color of background
noLoop(); // loops once
noFill(); // doesn't fill squares
rectMode(CENTER); // bases squares in the center rather than corner
}
void draw(){
for (int i = 50; i < 500; i = i + 50){
r = 0; // resets the rotation of the squares in every column
for(int j = 50; j < 1000; j = j + 50){
float x = random(.05, .1); // increments rotation
float y = j / 50; // position of squares
translate(i, j); // moves the squares right 50 and down 50
rotate(r); // rotates the squares
rect(random(-y, y),random(-y, y), 50, 50); // creates a square at a in the range of y
resetMatrix(); // resets the square back its original position
r = r + random (-x, x); // rotates the square at a random increasing rotation
}
}
}