Hello Processing foundation
I want my code to create new random (x,y) ellipses with an interval of 2 seconds.
So when you start the code it will after two seconds draw an ellipse (at a random(x,y)), and then after another 2 seconds it will draw another ellipse (at a random(x,y)) but without deleting the previously drawn ellipse.
This is my code so far:
int startTime;
final int DISPLAY_DURATION = 2000;
void setup(){
size(600, 400);
startTime = millis();
}
void draw(){
background(180);
if (millis() - startTime > DISPLAY_DURATION) {
fill(random(0,255),random(0,255),random(0,255));
ellipse(random(0,600),random(0,400),20,20);
startTime = millis();
}
}
This code works if you just remove the background(180) at draw() and put it into setup() but this is not the way I want to do it.