# My infinity watch project

**URL:** <https://discourse.processing.org/t/my-infinity-watch-project/14743>\
**Category:** Coding Questions\
**Created:** [October 16, 2019, 2:03pm UTC](https://discourse.processing.org/t/my-infinity-watch-project/14743 "2019-10-16T14:03:07Z")\
**Posts on this page:** 2\
**Page:** 1

<div class="post-metadata">

**Author:** ![andi](https://yyz2.discourse-cdn.com/flex036/user_avatar/discourse.processing.org/andi/32/6789_2.png) [@andi](https://discourse.processing.org/u/andi)\
**Post date:** [October 16, 2019, 2:03pm UTC](https://discourse.processing.org/t/my-infinity-watch-project/14743/1 "2019-10-16T14:03:07Z")

</div>

Hi guys,

I want to create a watch wich runs on an infinity symbol (24 h one whole turn). Therefore I created some code with a friend. (you can see below)

main:

```auto
float amp = 0.0;
float amp_offset = 150.0;
float amp_stretch_faktor = 50.0;
float winkel_offset = 75.0;
float radius = amp_stretch_faktor;
float laenge = 90*3;
float x, y = 0.0;
Point[] points = new Point[0]; 
int current_active = 1;
int count = 0;

void setup() {
  println(points.length);
  size(600, 600);
  noStroke();
  //sin und cos
  for (float winkel = 90; winkel <= laenge; winkel+=1.0)
  {
    fill(0);
    amp = amp_offset + sin(radians(winkel))*amp_stretch_faktor;
    points = (Point[])append(points, new Point(winkel+winkel_offset, amp));
    count+=1; 
  }
 
  //rechter halbkreis
  for (float winkel = 270; winkel <= 450; winkel+=1.0)
  {count+=1;
    x = winkel_offset + laenge + cos(radians(winkel)) * radius;
    y = amp_offset + sin(radians(winkel)) * radius;
    points = (Point[])append(points, new Point(x, y));
  }

  for (float winkel = laenge; winkel >= 90; winkel-=1.0)
  {count+=1;
    amp = amp_offset + -sin(radians(winkel))*amp_stretch_faktor;
    points = (Point[])append(points, new Point(winkel+winkel_offset, amp));
  }

  //linker halbkreis
  for (float winkel = 270.0; winkel >= 90.0; winkel-=1.0)
  {count+=1;
    x = winkel_offset + 90 + cos(radians(winkel))*radius;
    y = amp_offset + sin(radians(winkel))*radius;
    points = (Point[])append(points, new Point(x, y));
  }
  
  print("laengeist");
   println(points.length);
  print("laengesoll"); 
  println(count);
  
}

 void draw()
{
   
  background(255);
  points[current_active].deactivate();

  if(current_active >= points.length - 1)
  {
    current_active = 0;
  } else {
    current_active +=1;
  }
  points[current_active].activate();
  for (int i = 1; i <points.length; i+=1)
  {
    points[i].draw();
    println(y);
  }
 
} 

```

point:

```auto
class Point { 
  color c;
  float xpos;
  float ypos;
  int xsize;
  int ysize;

  Point(float xpos, float ypos)
  {
    this.c = color(255);
    this.xpos = xpos;
    this.ypos = ypos;
    this.xsize = 1;
    this.ysize = 1;
  }

  boolean activate()
  {
    this.c = color(0);
    this.xsize = 5;
    this.ysize = 5;
    return true;
  }
  boolean deactivate()
  {
    this.c = color(255);
    this.xsize = 1;
    this.ysize = 1;
    return true;
  }
  void draw()
  {
    rect(this.xpos, this.ypos, this.xsize, this.ysize);
    return;
  }
}

```

Now, the idea is to adjust the speed of the point to the 24 hours and in addition a minute-point too.  
One idea was to create an array filled with points of the graph and devide them by the time. But my skills are to bad. Can someone help?

Thanks in advance 🙂

---

<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:** [October 18, 2019, 2:21pm UTC](https://discourse.processing.org/t/my-infinity-watch-project/14743/2 "2019-10-18T14:21:50Z")

</div>

> [@andi](#):
>
> Point points

That’s already a list of points.

When you have a similar list or ArrayList! for all points of the line (the 8) you’re almost there. (I am not sure whether your list already contains all points).

Now please use hour minute and second to calculate the number of minutes since midnight.

```auto
secondsSinceMidnight= seconds() +
minutes() * 60 +
hours() * 60 * 60; // I believe 

```

Now use the command map

```auto
indexOfList = int(map(secondsSinceMidnight,
0, secondsPerDay,
0, list.size())); // if list is an Arraylist 

```

draw the point at this index in the list in another color
