title: How to control how many times something is shown in Processing?
body: <pre><code>void setup() {
    background(0);
    fullScreen();
  }
  
  void draw() {
    int g = 0;
    float cCount = map(mouseY, 0, height, 1, 20);
    for (int i = 0; i &lt; width; i+=50) {
      while(g &lt; cCount) {
       circle(i, mouseY, 20); 
      }
    }
  }
  
  
  </code></pre>
  <p>So what I'm trying to do is change the number of times circles are shown on the screen as I move the mouse. When the mouse moves down, more circles are shown on the screen all with the same Y coordinate but the distance between each circle is 50. As I move the mouse up, less circles are shown. Max circles is 20 and min is 1. I don't know how to set up a way for the number of circles to change as I move the mouse?</p>