xxxxxxxxxx
56
let x = 0;
let y = 0;
let w = 20;
let h = 20;
let wmin = 1;
let wmax = 60;
let hmin = 2;
let hmax = 70;
let rmin = -8;
let rmax = -8;
let o = 14;
function setup() {
createCanvas(540,540);
frameRate(20);
background(255);
angleMode(DEGREES);
rectMode(CENTER);
}
function draw() {
// fill(255,5);
// rect(0,0,width,height);
for(let i = 0; i < 20; i++) makeSquares();
}
function makeSquares() {
fill(random(200,255),random(120,220));
stroke(random(100,228),200);
push();
translate(x,y);
if(random(100)>94) rotate(random(rmin,rmax));
rect(0,0,w,h);
if(random(100)>78) {
fill(random(180,255),random(120,220));
if(random(100)>90) rotate(random(rmin,rmax));
rect(0+random(-o,o),0+random(-o,o),w,h);
}
pop();
x += w;
if(x >= width) {
x = 0;
y += h;
h = random(hmin,hmax);
w = random(wmin,wmax);
}
if(y >= height) {
y = 0;
x = 0;
rmin = random(-6,-2);
rmax = random(2,7);
}
}