xxxxxxxxxx
25
let size = 50; let cols = 5; let rows = 5;
function setup() {
createCanvas(400, 400, WEBGL);
}
function draw() {
background(220);
for (let i=0; i<cols; i++) {
for (let j=0; j<rows; j++) {
push();
noFill();
let x = size/2 + i*size - size * cols/2;
let y = size/2 + j*size - size * rows/2;
translate(x, y);
box(size);
pop();
}
}
fill(255, 0, 0);
ellipse(0, 0, 10, 10);
}