xxxxxxxxxx
function setup() {
createCanvas(400, 400);
background(255); // Set the canvas background to white
let cellSize = 80; // Size of each cell
for (let x = 0; x < width; x += cellSize) {
for (let y = 0; y < height; y += cellSize) {
// Draw a black rectangle for each cell
fill(0);
stroke(255);
rect(x, y, cellSize, cellSize);
// Z
let rotation = random(0, 360); // Random
push();
translate(x + cellSize / 2, y + cellSize / 2); // Move to center of cell
rotate(radians(rotation)); // Apply random rotation in degrees
textSize(cellSize * 0.6); // Z size
textAlign(CENTER, CENTER);
fill(255);
text('Z', 0, 0);
pop();
}
}
}