/* built with Studio Sketchpad:
* https://sketchpad.cc
*
* observe the evolution of this sketch:
* https://dflab.sketchpad.cc/sp/pad/view/ro.QVvjuzIjEdy/rev.141
*
* authors:
* Teresa Castro
*
* license (unless otherwise specified):
* creative commons attribution-share alike 3.0 license.
* https://creativecommons.org/licenses/by-sa/3.0/
*/
// Variável para gurdar o tempo em que a ultima frame foi desenhada
long last_update = 0;
// Variável para gurdar o tempo da animação
long anim_time = 0;
// tempo total de animação
long max_anim_time = 1000;
void setup() {
size(300, 300);
background(0);
// a função millis() dá-nos o tempo em milissegundos desde
// que o sketch começou;
last_update = millis();
}
void draw() {
background(0);
// tempo actual
long now = millis();
// tempo desde a ultima frame
long delta = millis() - last_update;
last_update = now;
// objecto que pulsa a cada 2 segundos
anim_time = (anim_time + delta) % max_anim_time;
fill(10,200,200)
ellipse (width/2, height/2, anim_time / 20, anim_time / 20);
fill(100,200,200)
ellipse (width/4, height/4, anim_time / 20, anim_time / 20);
fill(100,200,200)
ellipse (width/2, height/4, anim_time / 20, anim_time / 20);
fill(100,200,200)
ellipse (width/4, height/2, anim_time / 20, anim_time / 20);
fill(100,200,200)
ellipse (width/1, height/2, anim_time / 20, anim_time / 20);
fill(100,200,200)
ellipse (width/1, height/4, anim_time / 20, anim_time / 20);
fill(100,200,200)
ellipse (width/50, height/60, anim_time / 20, anim_time / 20);
fill(100,200,200)
ellipse (width/1, height/1, anim_time / 20, anim_time / 20);
fill(100,200,200)
ellipse (width/300, height/300, anim_time / 20, anim_time / 20);
}