Matrix Manipulation

Filed under: sketches

float angle;

void setup() {
  size(600, 600);
  smooth();
}

void draw() {
  background(200);

  pushMatrix();
  // moves origin to center of screen
    translate(width/2, height/2);
    rotate(frameCount * 0.01);
    scale(frameCount%200 * 0.01);
    angle = 0;

    for(int i=0; i<10; i++) {
      pushMatrix();
        rotate(angle);
        line (width/2 - 20, 0, width/2, frameCount%200*3);
        ellipse(width/2 - 20, 0, 30, 30);
      popMatrix();
      angle += TWO_PI / 10;
    }
  popMatrix();
}

bene posted on April 8th, 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