> show canvas only <


/* built with Studio Sketchpad: 
 *   https://sketchpad.cc
 * 
 * observe the evolution of this sketch: 
 *   https://hewitt.sketchpad.cc/sp/pad/view/ro.HJxUQGvS0Vw/rev.4
 * 
 * authors: 
 *   Rachel Trugerman

 * license (unless otherwise specified): 
 *   creative commons attribution-share alike 3.0 license.
 *   https://creativecommons.org/licenses/by-sa/3.0/ 
 */ 



//no variables declared here because they are only used in the circles() function
    float r, g, b, x, y, d; //these are floats because random() returns a float
void setup() {
  size(400,400);
  background(255);
  noStroke();
  smooth();
      r= 255;
    g= 0;
    b= 0;12

}

void draw() {
  //nothing in draw but we still need it to loop continuously
}

void keyPressed() {//when you click, do circles()
  circles();
}

void circles() {
  int number = 0;//number of circles changes depending on where you click
  //multiple exclusive conditions, divides window into 6 vertical areas for detecting click
  if(key == '1') {
    number = 20;
    r= 255;
    g= 0;
    b= 0;
  } else if(key== '2') {
    r= 0;
    g= 255;
    b= 0;
    number = 40;
  } else if(key== '3') {
    r= 0;
    g= 0;
    b= 255;
    number = 60;
  }  else if(key== '4') {
      r= 100;
      g= 0;
      b= 100;
      number= 80;
  }  else if (key== '5') {
        r= 255;
        g= 70;
        b= 70;
        number= 100;
  }     else if (key== '6') {
          r= 60;
          g= 190;
          b= 200;
          number= 60;
  }       else if (key== '7') {
            r= 200;
            g= 100;
            b= 50;
            number= 120;
      
  } else if(mouseX >= width/6*3 && mouseX < width/6*4) {
    number = 50;
  } else if(mouseX >= width/6*4 && mouseX < width/6*5) {
    number = 70;
  } else {
    number = 100;
  }
  background(255);
  for(int i=0;i<number;i++) {//make number of ellipses set above
    y  = random(height); //set random values each pass through the loop
    x  = random(width);
    d = 20;
    fill(r,g,b);
    ellipse(x,y,d,d);
  }
}