xxxxxxxxxx
23
let x = 12, y = x, w = 30, h = w, offset = 2, grid = 15, many = grid*grid;
let shownum=true;
function setup() {
createCanvas(500, 500);
noStroke();
}
function draw() {
background(220);
myRects();
}
function myRects() {
for (let i = 0; i < many; i++) {
let posx = x+(i%grid)*(w+offset);
let posy = y+(floor(i/grid))*(h+offset);
fill(0, 200, 0);
rect(posx, posy, w, h); // or any other shape/text on that position
fill(200,0,0);
if ( shownum ) text(i+1,posx+5,posy+h/2);
}
}