Fal­l­i­n­g Rot­a­t­i­n­g Square

by Matthew Chensee
  • Show Sketch
/** @peep sketchcode **/
 
float angle = 0.0;
float y = 30.0;
float speed = 1.0;
 
void setup() {
  size(200, 200);
  background(0);
  noStroke();
}
void draw() { 
  fill(0, 12);
  rect(0, 0, width, height);
  fill(255);
  translate(100, y);
  rotate(angle);
  rect(-60, -60, 120, 120);
  angle = angle + 0.02;
  y += speed;
  if (y > height + 120)
  {
    y = -120;
  }
}

Comments

Nobody has said anything yet.