xxxxxxxxxx
function setup() {
createCanvas(400, 400);
angleMode(DEGREES);
rectMode(CENTER);
}
function draw() {
background(100);
// Recipe to transform a shape
// To make a shape appear to rotate on its own
// 1. first translate to the center of the shape.
// 2. rotate the shape
push();
translate(200, 200);
rotate(-frameCount);
rect(0, 0, 100);
pop();
push();
translate(width/2, height/2);
rotate(frameCount);
rect(0, 0, 50);
pop();
}