/* built with Studio Sketchpad:
* https://sketchpad.cc
*
* observe the evolution of this sketch:
* https://dflab.sketchpad.cc/sp/pad/view/ro.W7g7trmwqvu/rev.1
*
* authors:
* Sofia Gomez
* license (unless otherwise specified):
* creative commons attribution-share alike 3.0 license.
* https://creativecommons.org/licenses/by-sa/3.0/
*/
float px[];
float py[];
int num_particles = 50;
void setup() {
size(300, 300);
background(255);
fill (220, 235, 44);
px = new float[num_particles];
py = new float[num_particles];
for (int i = 10; 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 (38, 42, 62);
for (int i = 0; i < num_particles; i = i+1) {
px[i] = constrain (px[i] + random (-10, 10), 0, width);
py[i] = constrain (py[i] + random (-10, 10), 0, height);
ellipse (px[i], py[i], 10, 10);
}
}