> show canvas only <


/* built with Studio Sketchpad: 
 *   https://sketchpad.cc
 * 
 * observe the evolution of this sketch: 
 *   https://dflab.sketchpad.cc/sp/pad/view/ro.PLVbAx5zgUc/rev.173
 * 
 * authors: 
 *   anaritaf

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



// as instruções que estiverem dentro desta função setup() 
// correm uma vez quando o programa arranca



float px[];
float py[];
 
int num_particles = 500;

void setup() {  
    
    // tamanho da tela
    size(600, 400); 

    // cor de fundo
    background(203,74,74);
    
    px = new float[num_particles];
    py = new float[num_particles];
    
    for (int i = 0; i < num_particles; i++) {
        px[i] = random (width);
        py[i] = random (height);
    }
} 

// as instruções que estiverem dentro desta função draw
// são executadas a cada novo frame

void draw() {
     //background(203,74,74);
    
    for (int i = 0; i < num_particles; i = i+1) {
        px[i] = constrain (px[i] + random (-5, 5), 0, width);
        py[i] = constrain (py[i] + random (-5, 5), 0, height);
        
        if (dist (px[i], py[i], mouseX, mouseY) < 40) {
            vx = (px[i] - mouseX);
            vy = (py[i] - mouseY);
            
            px[i] = px[i] + vx;
            py[i] = py[i] + vy;
        }
fill(15,211,206);
        ellipse (px[i], py[i], 10, 10);
    }

 for (int i = 0; i < num_particles; i = i+1) {
        px[i] = constrain (px[i] + random (-5, 5), 0, width);
        py[i] = constrain (py[i] + random (-5, 5), 0, height);
        
        if (dist (px[i], py[i], mouseX, mouseY) < 40) {
            vx = (px[i] - mouseX);
            vy = (py[i] - mouseY);
            
            px[i] = px[i] + vx;
            py[i] = py[i] + vy;
        }
fill(149,44,111);
        ellipse (px[i], py[i], 10, 10);
    }

for (int i = 0; i < num_particles; i = i+1) {
        px[i] = constrain (px[i] + random (-5, 5), 0, width);
        py[i] = constrain (py[i] + random (-5, 5), 0, height);
        
        if (dist (px[i], py[i], mouseX, mouseY) < 40) {
            vx = (px[i] - mouseX);
            vy = (py[i] - mouseY);
            
            px[i] = px[i] + vx;
            py[i] = py[i] + vy;
        }
fill(145,240,195);
        ellipse (px[i], py[i], 8, 8);
    }

}