xxxxxxxxxx
let rows, cols;
let side = 20;
function setup() {
setFrameRate(2);
createCanvas(450, windowHeight);
cols = Math.floor(400/side);
rows = Math.floor((height-25)/side);
background(255);
angleMode(DEGREES);
}
function draw() {
background(255);
translate(25,25);
stroke(0);
strokeWeight(0.5);
rectMode(CENTER);
fill(255,255,255,0);
for(var i = 0; i < cols; i++){
for(var j = 0; j < rows; j++){
push();
x = side*i + side/2;
y = side*j + side/2;
if(j > rows/3){
x+=random(-0.3*j,0.3*j)
y+=random(-0.4*j,0.4*j)
}
translate(x , y);
rotate(random(2*j));
rect( 0, 0, side, side);
pop();
}
}
noLoop();
}