xxxxxxxxxx
44
var boolDoRefresh;
function setup() {
createCanvas(400, 400);
boolDoRefresh = true;
}
let rectx = 50;
let recty = 50;
let rad = 30;
let border = 10;
function draw() {
if (boolDoRefresh) {
//init
rad = random(10, 40);
bord = (400 - rad*8)/14;
noStroke();
background(42);
for (let row = 0; row < 8; row++) {
for (let col = 0; col < 8; col++) {
//random color here!-----orange ish
fill(255 - random(30), 80 + random(120), random(20));
//size variation
//drawing part here! ----
let r = random();
if (r < 0.2) {
ellipse(bord+ row*rectx + rad/2, bord + col*recty+ rad/2, rad, rad);
} else if (r > 0.95) {
triangle(bord + row*rectx + rad/2, bord + col*recty, bord + row*rectx, bord + col*recty + rad, bord + row*rectx + rad, bord + col*recty + rad);
} else {
rect(bord + row*rectx, bord + col*recty, rad, rad);
//rect(10 + row*rectx, 10 + col*recty, rad, rad);
}
}
}
boolDoRefresh = false;
}
}
function mousePressed() {
boolDoRefresh = true;
}