> show canvas only <


/* built with Studio Sketchpad: 
 *   https://sketchpad.cc
 * 
 * observe the evolution of this sketch: 
 *   https://dflab.sketchpad.cc/sp/pad/view/ro.95Hpdn$5Ot7/rev.104
 * 
 * authors: 
 *   Diana Bernardo

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



// This sketch builds on a prior work, "Modified clone of '07 - Aleatoriedade'", created by Diana Bernardo
// http://dflab.sketchpad.cc/sp/pad/view/ro.9tPnGP5wbirgGT/rev.3



// This sketch builds on a prior work, "07 - Aleatoriedade", created by Pedro Ângelo
// http://dflab.sketchpad.cc/sp/pad/view/ro.9DrvlXt4IEC1-C/rev.386



// o movimento aleatório é característico de certos objectos 
// (fumo, insectos), etc. e pode ser simulado usando a função random()

float px;
float py;
color col;
float jump = 30;

void setup() {  
    size(500, 500); 

    background(255);
    col = color(int(random(255)),int(random(255)), int(random(255)));
    px = random (width);
    py = random (height);
} 

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

void draw() {
    float npx = constrain (px + random (-jump, jump), 0, width);
    float npy = constrain (py + random (-jump, jump), 0, height);
    col = color(int(random(255)),int(random(255)), int(random(255)));

    fill (col);
    noStroke ();
    ellipse (mouseX, mouseY, npx, npy);
    
    px = npx;
    py = npy;
}