xxxxxxxxxx
41
// notes from professor shiffmans class on yt. blesss his heart
// circunfrance of a circle = 2 pi r (radian)
// unit circle = 1 or also 2 pi
let angle = 0;
let x = 10;
let y =10;
function setup() {
createCanvas(400, 400);
angleMode(DEGREES);
rectMode(CENTER);// how to make the rect rotate in teh center;
}
function draw() {
background(0);
fill(255,0,50);
//stroke(255);
push(); // this save tranformations
translate(x,y); // moves the origin
// use push and pop to self contain some code with in its own transformation world
rotate(angle);
rect(0,0,100,50);
pop(); //this restores transformations
// line(0,0,50,50);
//rect(0,0,50,10); // rotating around its origin after translte sets its new origin
//x= x+2;
// y= y+2;
translate(300,300);
rotate (-angle*3);
fill(50,100,255);
rect(0,0,100,50);
angle= angle+1;
if(x> width || y> height){
x= 10;
y =10;
}
}