xxxxxxxxxx
54
function setup() {
createCanvas(3000, 3000);
let grid = 2;
let scl = width / grid;
let size = scl * 0.80;
let offset = 0.5 * (scl - size);
let steps = 4;
cols = [color("#FEF7DC"),color("#E6DDC6"),color("#C2B8A3")];
background(255);
noStroke();
fill(color("#A0937D"))
rect(0,0,width,height,width/30);
rectMode(CENTER);
let round = 0;
while (round < steps) {
let n_square = floor(random(grid * grid));
let counter = 0;
for (let i = 0; i < grid; i++) {
for (let j = 0; j < grid; j++) {
push();
translate(scl * i + 0.5 * scl, scl * j + 0.5 * scl);
if (n_square == counter) {
if (round <= 1){
fill(random(cols));
rect(0, 0, size,size,width/30);}
pop();
counter++;
continue;
}
fill(random(cols));
ellipse(0, 0, size);
pop();
counter++;
}
}
let i = floor(n_square / grid);
let j = n_square % grid;
translate(scl * i + offset, scl * j + offset);
scale(size / width);
round++;
}
save("ellipses&squares");
}
function draw() {
noLoop();
}