xxxxxxxxxx
33
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);
// rotate the rect()
rotate(rotation_amount);
stroke(255, 0, 255);
fill(255, 0, 0);
rect(0, 0, 100, 100);
// rotate the line() twice as fast
rotate(rotation_amount * 2);
stroke(0, 200, 255);
line(0, 0, 0, 100)
// increase the rotation value
rotation_amount += rotation_speed;
}