topical media & game development

talk show tell print

graphic-processing-learning-14-example-14-15-example-14-15.pde / pde



  // Learning Processing
  // Daniel Shiffman
  // http://www.learningprocessing.com
  
  // Example 14-15: Rotating many things using objects
  
  // An array of Rotater objects
  Rotater[] rotaters;
  
  void setup() {
    size(200,200);
    
    rotaters = new Rotater[20];
    
    // Rotaters are made randomly
    for (int i = 0; i < rotaters.length; i++ ) {
      rotaters[i] = new Rotater(random(width),random(height),random(-0.1,0.1),random(48));
    }
  }
  
  void draw() {
    background(255);
    
    // All Rotaters spin and are displayed
    for (int i = 0; i < rotaters.length; i++ ) {
      rotaters[i].spin();
      rotaters[i].display();
    }
  }
  


(C) Æliens 20/2/2008

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.