topical media & game development

talk show tell print

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



  // Learning Processing
  // Daniel Shiffman
  // http://www.learningprocessing.com
  
  // Example 14-1: A growing rectangle, or a rectangle moving toward you?
  
  float r = 8;
  
  void setup() {
    size(200,200);
  }
  
  void draw() {
    background(255);
    
    // Display a rectangle in the middle of the screen
    stroke(0);
    fill(175);
    rectMode(CENTER);
    rect(width/2,height/2,r,r);
    
    // Increase the rectangle size
    r++ ;
    
    // Start rectangle over
    if (r > width) {
      r = 0;
    }
  }
  


(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.