Hey guys.
I'm making a clock in the form of a "loading bar" using Processing.
- It's my goal to have the bar LOAD from 12 o clock in the night until 12 o clock in the midday.
- And to have it LOAD BACK (unload) from 12 o clock in the midday until 12 o clock in the night.
..........
Right now I'm having a lot of trouble to make the bar LOAD BACK after it hits 12 o clock in the midday.
Does anyone know the proper code to make it work?
This is my code:
float Time = 0;
float Check = 600;
int Sized = 20;
int Count = 0;
void setup(){
colorMode(RGB, 720);
size ( 800,400);
background(0);
noStroke();
smooth();
}
void draw() {
float s = second();
float m = minute()*60;
float h = hour()*3600;
Time = (m+s+h)*0.01388889;
println (Time);
println (m+s+h);
if( h >= 12) {
fill(720);
rect( 100, 200, 50, Sized);
fill(200);
rect( 150, 200, 50, Sized);
fill(255);
rect( 200, 200, 50, Sized);
fill(200);
rect( 250, 200, 50, Sized);
fill(255);
rect( 300, 200, 50, Sized);
fill(200);
rect( 350, 200, 50, Sized);
fill(255);
rect( 400, 200, 50, Sized);
fill(200);
rect( 450, 200, 50, Sized);
fill(255);
rect( 500, 200, 50, Sized);
fill(200);
rect( 550, 200, 50, Sized);
fill(255);
rect( 600, 200, 50, Sized);
fill(200);
rect( 650, 200, 50, Sized);
fill(720-(hour()*12),hour()*12,0);
rect( 100, 200, Time, Sized);
}
else {
fill(720);
rect( 100, 200, 50, Sized);
fill(360);
rect( 150, 200, 50, Sized);
fill(255);
rect( 200, 200, 50, Sized);
fill(100);
rect( 250, 200, 50, Sized);
fill(255);
rect( 300, 200, 50, Sized);
fill(100);
rect( 350, 200, 50, Sized);
fill(255);
rect( 400, 200, 50, Sized);
fill(100);
rect( 450, 200, 50, Sized);
fill(255);
rect( 500, 200, 50, Sized);
fill(100);
rect( 550, 200, 50, Sized);
fill(255);
rect( 600, 200, 50, Sized);
fill(100);
rect( 650, 200, 50, Sized);
fill(0,0,0);
rect( 100, 200, Check - Time, Sized);
}
}
Thanks in advance!
I'm making a clock in the form of a "loading bar" using Processing.
- It's my goal to have the bar LOAD from 12 o clock in the night until 12 o clock in the midday.
- And to have it LOAD BACK (unload) from 12 o clock in the midday until 12 o clock in the night.
..........
Right now I'm having a lot of trouble to make the bar LOAD BACK after it hits 12 o clock in the midday.
Does anyone know the proper code to make it work?
This is my code:
float Time = 0;
float Check = 600;
int Sized = 20;
int Count = 0;
void setup(){
colorMode(RGB, 720);
size ( 800,400);
background(0);
noStroke();
smooth();
}
void draw() {
float s = second();
float m = minute()*60;
float h = hour()*3600;
Time = (m+s+h)*0.01388889;
println (Time);
println (m+s+h);
if( h >= 12) {
fill(720);
rect( 100, 200, 50, Sized);
fill(200);
rect( 150, 200, 50, Sized);
fill(255);
rect( 200, 200, 50, Sized);
fill(200);
rect( 250, 200, 50, Sized);
fill(255);
rect( 300, 200, 50, Sized);
fill(200);
rect( 350, 200, 50, Sized);
fill(255);
rect( 400, 200, 50, Sized);
fill(200);
rect( 450, 200, 50, Sized);
fill(255);
rect( 500, 200, 50, Sized);
fill(200);
rect( 550, 200, 50, Sized);
fill(255);
rect( 600, 200, 50, Sized);
fill(200);
rect( 650, 200, 50, Sized);
fill(720-(hour()*12),hour()*12,0);
rect( 100, 200, Time, Sized);
}
else {
fill(720);
rect( 100, 200, 50, Sized);
fill(360);
rect( 150, 200, 50, Sized);
fill(255);
rect( 200, 200, 50, Sized);
fill(100);
rect( 250, 200, 50, Sized);
fill(255);
rect( 300, 200, 50, Sized);
fill(100);
rect( 350, 200, 50, Sized);
fill(255);
rect( 400, 200, 50, Sized);
fill(100);
rect( 450, 200, 50, Sized);
fill(255);
rect( 500, 200, 50, Sized);
fill(100);
rect( 550, 200, 50, Sized);
fill(255);
rect( 600, 200, 50, Sized);
fill(100);
rect( 650, 200, 50, Sized);
fill(0,0,0);
rect( 100, 200, Check - Time, Sized);
}
}
Thanks in advance!
1