Mapping time to an array

Hi there,

I’m trying to display a new ellipse on the sketch as each second goes by, to eventually get a row of ellipses. I’m running in to trouble displaying a new ellipse though. Thanks for the help!

void setup(){
size (600,600);
background(255);

}

void draw(){
background(255);

float s = second();
float mapped_s = map(s,0,59,0,1000);

ellipse (30,30,30,30);

for (int i = 0; i<mapped_s; i++){
ellipse[i].display();
}

}

void keyPressed (){
if(key == ‘x’) saveFrame(“check_in_19_timer_Lena.png”);

}

or use a timer



int mapped_s = 0; 
int start; 

void setup() {
  size (600, 600);
  background(255);
  start = millis();
}

void draw() {
  background(255);

  // timer 
  if (millis() - 1000 > start) {
    mapped_s++;
    start = millis();
  }

  for (int i = 0; i<mapped_s; i++) {
    ellipse (30*i+15, 30, 30, 30);
  }
}