/* built with Studio Sketchpad:
* https://sketchpad.cc
*
* observe the evolution of this sketch:
* https://dflab.sketchpad.cc/sp/pad/view/ro.JPrDWb65skr/rev.97
*
* authors:
* Bruno Goncalves
* 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, "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;
float jump = 30;
void setup() {
size(300, 300);
background(50);
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);
fill(200,0,0,5);
noStroke();
ellipse (px, py, npx, npy);
px = npx;
py = npy;
fill(0,200,0,5);
noStroke();
ellipse (px, py, npy, npx);
px = npx;
py = npy;
fill(0,0,200,5);
noStroke();
ellipse (py, px, npx, npy);
px = npy;
py = npy;
}