xxxxxxxxxx
33
// create a canvas of 900 by 900 pixels
function setup() {
createCanvas(3000, 3000);
}
// draw the squares
function draw() {
// set the background color to black
background(0);
// set the stroke color to white
stroke(255);
// set the stroke weight to 4 pixels
strokeWeight(2);
// set the fill color to transparent
noFill();
// loop through the squares
for (let i = 0; i < 10; i++) {
// calculate the side length of the square
let side = 50 + i * 14;
// calculate the top left corner of the square
let x = (width - side) / 2;
let y = (height - side) / 2;
// apply rotation to each square with an incremental angle
push();
translate(x + side / 2, y + side / 2);
rotate(radians(8 * 9));
rect(-side / 2, -side / 2, side, side);
pop();
}
}