# Mapping time to an array

**URL:** <https://discourse.processing.org/t/mapping-time-to-an-array/25286>\
**Category:** Coding Questions\
**Created:** [November 8, 2020, 5:29pm UTC](https://discourse.processing.org/t/mapping-time-to-an-array/25286 "2020-11-08T17:29:50Z")\
**Posts on this page:** 2\
**Page:** 1

<div class="post-metadata">

**Author:** ![lkalotihos](https://avatars.discourse-cdn.com/v4/letter/l/94ad74/32.png) [@lkalotihos](https://discourse.processing.org/u/lkalotihos)\
**Post date:** [November 8, 2020, 5:29pm UTC](https://discourse.processing.org/t/mapping-time-to-an-array/25286/1 "2020-11-08T17:29:50Z")

</div>

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”);
> 
> }

---

<div class="post-metadata">

**Author:** ![Chrisir](https://yyz2.discourse-cdn.com/flex036/user_avatar/discourse.processing.org/chrisir/32/45_2.png) [@Chrisir](https://discourse.processing.org/u/Chrisir)\
**Post date:** [November 8, 2020, 9:28pm UTC](https://discourse.processing.org/t/mapping-time-to-an-array/25286/2 "2020-11-08T21:28:36Z")

</div>

or use a timer

```auto

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);
  }
}

```
