topical media & game development

talk show tell print

graphic-processing-algorithm-Ch06-p137-p137.pde / pde



  float px[] = new float[300];
  float py[] = new float[300];
  float pr[] = new float[360];
  void setup(){
    size(300,300);
  }
  void draw(){
  }
  void mousePressed(){
    for(int i=0; i<mouseY; i++){
      px[i] = random(width);
      py[i] = random(height);
      pr[i] = random(360);
    }
  }
  void mouseDragged(){
    background(255);
    for(int i=0; i<mouseY; i++){
      pushMatrix();
      rectMode(CENTER);
      translate(px[i],py[i]);
      rotate(radians(pr[i] + mouseX));
      rect(0,0,5,500);
      popMatrix();
    }
  }
  


(C) Æliens 04/09/2009

You may not copy or print any of this material without explicit permission of the author or the publisher. In case of other copyright issues, contact the author.