size(200,200);
background(255);
float w = ________;
while (________)  {
  stroke(0);
  fill(________);
  ellipse(_______,_______,_______,_______);
  __________20;
}
Example
// Learning Processing
// Daniel Shiffman
// http://www.learningprocessing.com

// Exercise 6-1b

size(200,200); 
background(255); 
smooth();

float w = width; 
while (w > 0) { 
  stroke(0); 
  fill(w); 
  ellipse(width/2,height/2,w,w); 
  w = w - 20; 
} 
  • Guipena

    Could you explain how you defined the different colors using “fill(w)”?

  • Anonymous

    ‘w’ is simply a variable that starts at 200 and decrements by 20 each cycle through the loop (200,180,160,140,etc.).  Since it’s a number it can be used for anything.  And here it is used to (a) define the size of each circle and (b) the fill color.  A greyscale color in Processing has a range between 0 and 255 (0 being black and 255 white).

  • AhAdel

    this loop argument didn’t executed : while (w<=0) {
    why ??

  • AhAdel

    sorry, the loop that didn’t executed : while (w<= 200) {
    why ??

  • Anonymous

    w starts at the value 200 which is not less than 0.  Therefore the boolean returns false and the loop is bypassed.