xxxxxxxxxx
27
let cols = 6; let rows = 6; let size = 50; let marginX; let marginY;
function setup() {
createCanvas(400, 400, WEBGL);
background(220);
marginX = (width-(size*cols))/2;
marginY = (height-(size*rows))/2;
for (let i=0; i<cols; i++) {
for (let j=0; j<rows; j++) {
let x = i*size - (size*cols)/2;
let y = j*size - (size*rows)/2;
// rect(x, y, size, size);
push();
translate(size/2 + i*size - (size*cols)/2, size/2 + j*size - (size*rows)/2);
noFill();
box(size);
pop();
}
}
}
function draw() {
}