> show canvas only <


/* built with Studio Sketchpad: 
 *   https://sketchpad.cc
 * 
 * observe the evolution of this sketch: 
 *   https://studio.sketchpad.cc/sp/pad/view/ro.r2QTG2cxUuZ/rev.1276
 * 
 * authors: 
 *   Pablo Olmos de Aguilera Corradini
 *   Claudio Pinho
 *   
 *   PaBLoX

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



int width = 500;
int height = 200;

int ringRadius = 20;
int ringSize = 0;
int ringSpacer = 5;
int ringCounter;
int currentRingSize;

int ringPosX = width/2;
int ringPosY = height/2;

int actualPosX, actualPosY;
int iterations = 5;

void setup() {
    size(500, 200);
    frameRate(30);
    noFill();
}

void draw() {
    
    background(255);
    actualPosX = ringPosX;
    actualPosY = ringPosY;
   
    ring(actualPosX, actualPosY, ringSize);
    
    ringCounter = 1;
    currentRingSize = ringSize - ringSpacer;
    
    while (currentRingSize > 0 && ringCounter <= iterations) {
        ring(actualPosX, actualPosY, currentRingSize);
        ringCounter++;
        currentRingSize -= ringSpacer;        
    }
    
    ringSize++;
}


void  ring(x,y,diameter) {
    ellipse(x,y,diameter,diameter);
}