Transform: rotating squares

Filed under: sketches

void setup() {
  size(300, 300);
}

void draw() {
  background(0);
  fill(255);
  noStroke();
  smooth();
  frameRate(30);

  pushMatrix();
    translate(width/2, height/2);
    rotate(TWO_PI/30 * frameCount%60 * 0.5);
    //println(TWO_PI/30 * frameCount%60 * 0.5);
    rectMode(CENTER);
    rect(0, 0, 150, 150);
  popMatrix();

  pushMatrix();
    translate(width/2, height/2);
    rotate(-TWO_PI/30 * frameCount%30);
    fill(255, 0, 255);
    rect(0, 0, 50, 50);
  popMatrix();

}

bene posted on April 10th, 2008  

Leave a Comment

Required

Required, hidden

Some HTML allowed:
<a href="" title=""> <abbr title=""> <acronym title=""> <b> <blockquote cite=""> <code> <em> <i> <strike> <strong>

Trackback this post  |  Subscribe to the comments via RSS Feed


Pages

Calendar

January 2009
M T W T F S S
« May    
 1234
567891011
12131415161718
19202122232425
262728293031  

Most Recent Posts