title: How can I use a FOR loop to create circles in a circle (in Processing)
body: <p>I need to create a loop which will space circles equally around a circle in Processing.</p>
  
  <p>I know I can somehow implement a FOR loop.</p>
  
  <p>I need to be able to increase or decrease the number of circles around this circle (with button presses) but keep them equally spaced.</p>
  
  <p>I know the formula's I need to include in the FOR loop to get the X and Y axis. The formulas: </p>
  
  <pre><code>being
     X = R*cos(angle-90)+Y0
     Y = R*sin(angle-90)+X0
  </code></pre>
  
  <p>I understand the three parameters of the FOR loop; when does it start, when does it finish, what changes when it runs.</p>
  
  <p>What I can't see is how to implement the formulas into the FOR loop.</p>
  
  <p>Many thanks</p>
  
  <p>Here is the code I do have</p>
  
  <pre><code>void setup () {
    size (600, 600);
    background (255, 255, 255);
    smooth ();
    ellipse (width/2, height/2, 200, 200); // the guide circle. Not needed in final code.
  }
  
  
  void draw() {
  
  
    for (int i = 0; i &lt; 20; i ++) {
      for (int j = 0; j &lt; 20; j ++) {
  
        ellipse (i *20, j * 20, 20, 20);
      }
    }
  }
  </code></pre>