> show canvas only <


/* built with Studio Sketchpad: 
 *   https://sketchpad.cc
 * 
 * observe the evolution of this sketch: 
 *   https://studio.sketchpad.cc/sp/pad/view/ro.9oqUkxg4qlA/rev.570
 * 
 * authors: 
 *   
 *   김수련
 *   박재경
 *   황금빛
 *   
 *   황금빛
 *   
 *   현진
 *   정나라외다
 *   이경은
 *   
 *   유현수
 *   
 *   
 *   Donghee PARK
 *   구덕진
 *   Donghee PARK
 *   정이수

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



int num = 10;
Drop [] drops =  new Drop[num];

void setup(){
    size(400, 300);
    smooth();
    noStroke();

    
    for (int i=0; i <drops.length; i++) {
        drops[i] = new Drop(int(random(10,40)), random(1,3), random(400),0);        
     }
}
 
void draw() {
    background(0);

    for (int i=0; i <drops.length; i++) {
        drops[i].update();
    }

    for (int i=0; i <drops.length; i++) {
        drops[i].draw();
    }
}

class Drop {
    float [] x;
    float [] y;
    float speed;
    float acc;

    Drop(int num, float drop_speed, float start_x, float start_y) {
        x = new float[num];
        
        y = new float[num];
        speed = drop_speed;
        x[0] = start_x;
        y[0] = start_y;
        acc = random(0.09);
    }
    
    void update() {
        for (int i = x.length-1; i >0; i--){
            x[i] = x [i-1];
            y[i] = y [i-1];
        }
        speed += acc;
        y[0] += speed;
    }
    
    void draw() {
        fill(random(255),random(255),random(255),random(100));
        for (int i = 0; i < x.length; i++){
            ellipse(x[i], y[i], x.length-i,x.length-i);
        }
    }
}