xxxxxxxxxx
15
function setup() {
createCanvas(800, 600);
}
function draw() {
background(230, 230, 250);
// calculates rectangle size based on canvas dimensions
let rectWidth = width / 2;
let rectHeight = height / 2;
// draw the rectangle in the center
rect((width - rectWidth) / 2, (height - rectHeight) / 2, rectWidth, rectHeight);
}