s1mple Ani­m­a­t­i­o­n - Rect's and Circ's

by Travis Low
  • Show Code
/** @peep sketch **/
 
 
float angle = 0.0;
float y = 50;
float speed = 3;
 
void setup() {
  size(200, 200);
  background(0);
  noStroke();
  smooth();
  frameRate(60);
 
}
void draw() {
  fill(0, 12);
  rect(0, 0, width, height);
  fill(255);
  translate(100, y);
  rotate(angle);
  rect(-60, -60, 100, 100);
  angle = angle + 0.1;
 
  y += speed;
  if (y > height + 120) {
    y =- 120; 
  }
  //Green 
  pushMatrix();
  fill(0, 250, 0);
  ellipse(-10, 70, 20, 20);
  popMatrix();
  //PURP 
  pushMatrix();
  fill(250, 0, 250);
  ellipse(70, -10, 20, 20);
  popMatrix();
  //RED Rect
  pushMatrix();
  fill(250, 0, 0);
  rect(-10, -90, 20, 20);
  popMatrix();
  //BLU Rect
  pushMatrix();
  fill(20, 150, 250);
  rect(-90, -10, 20, 20);
  popMatrix();
}

Comments

Nobody has said anything yet.