xxxxxxxxxx
22
let cols = 4; let rows = 4; let size = 50;
function setup() {
createCanvas(400, 400);
}
function draw() {
background(220);
for (let i=0; i<cols; i++) {
for (let j=0; j<rows; j++) {
fill(255);
let x = i*size + size/2 + (width - size * cols)/2;
let y = j*size + size/2 + (height - size * rows)/2;
ellipse(x, y, size, size);
}
}
fill(255, 0, 0);
ellipse(width/2, height/2, 10, 10);
}