topical media & game development

talk show tell print

graphic-processing-learning-06-example-6-2-example-6-2.pde / pde



  // Learning Processing
  // Daniel Shiffman
  // http://www.learningprocessing.com
  
  // Example 6-2: Many lines with variables
  
  size(200,200);
  background(255);
  
  // Legs
  stroke(0);
  int y = 80;       // Vertical location of each line
  int x = 50;       // Initial horizontal location for first line
  int spacing = 10; // How far apart is each line
  int len = 20;     // Length of each line
  
  // Draw the first leg.
  line(x,y,x,y + len); 
  // Add spacing so the next leg appears 10 pixels to the right.
  x = x + spacing; 
  
  // Continue this process for each leg, repeating it over and over.
  line(x,y,x,y + len); 
  x = x + spacing;
  line(x,y,x,y + len);
  x = x + spacing;
  line(x,y,x,y + len);
  x = x + spacing;
  line(x,y,x,y + len);
  x = x + spacing;
  line(x,y,x,y + len);
  x = x + spacing;
  line(x,y,x,y + len);
  x = x + spacing;
  line(x,y,x,y + len);
  x = x + spacing;
  line(x,y,x,y + len);
  x = x + spacing;
  line(x,y,x,y + len);
  x = x + spacing;
  line(x,y,x,y + len);
  


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