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