# My infinity watch project

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:

``````float amp = 0.0;
float amp_offset = 150.0;
float amp_stretch_faktor = 50.0;
float winkel_offset = 75.0;
float laenge = 90*3;
float x, y = 0.0;
Point[] points = new Point;
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);
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;
points = (Point[])append(points, new Point(x, y));
}

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

for (float winkel = 270.0; winkel >= 90.0; winkel-=1.0)
{count+=1;
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:

``````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 2 Likes

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.

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

Now use the command map

``````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

1 Like