Week 8 Tut­o­r­i­a­l Ass­i­g­n­m­e­n­t

by Tsz Kwong Marco Tong
  • Show Code
/** @peep sketch */
float angle = 180;
 
void setup() {
  size(200, 200);
  rectMode(CENTER);
  strokeWeight(4);
}
 
void draw() {
  background(204);
  if (keyPressed == true) {
    angle += PI/15;
  } else if (mousePressed == true){
    angle -= PI/90;}
  translate(width/2, height/2);
  rotate(angle);
  rect(0, 0, 80, 80); // draw a rectangle
}

Comments

Nobody has said anything yet.