xxxxxxxxxx
29
let rotation_amount = 0;
let rotation_speed = 0.01;
function setup() {
createCanvas(400, 400);
// set the origin point for the rect() to its center
rectMode(CENTER);
}
function draw() {
background(100, 0, 200);
strokeWeight(10);
// move everything to the center of the canvas
translate(width/2, height/2);
// draw a rect() before rotating
stroke(0, 255, 255);
fill(255, 255, 0);
rect(0, 0, 250, 250);
// rotate the second rect();
rotate(90);
stroke(255, 0, 255);
fill(255, 0, 0);
rect(0, 0, 100, 100);
}