xxxxxxxxxx
function setup() {
createCanvas(800, 800);
noLoop(); // Stops draw from looping
stroke(0);
noFill(); // No fill, so the inside of the rectangles remains empty
let cols = 15; // Number of columns
let rows = 20; // Number of rows
let w = width / cols; // Width of each rectangle
let h = height / rows; // Height of each rectangle
for (let y = 0; y < rows; y++) {
for (let x = 0; x < cols; x++) {
let xPos = x * w + random(-10, 10); // Random offset for x position
let yPos = y * h + random(-10, 10); // Random offset for y position
let rectW = w * random(0.7, 1.2); // Random width variation
let rectH = h * random(0.7, 1.2); // Random height variation
rect(xPos, yPos, rectW, rectH); // Draw outer rectangle only
}
}
}