Countdown 09:00:00:00

edited November 2015 in JavaScript Mode

Hi guys, once again, I'm stuck with processing. I'm trying to write a countdown using day(), hour(), ecc. The problem is that I want the countdown to start counting starting from 09 days then goes until 00 days, and then it starts again. I'm trying to use day() because I want to use the code on a website (it should run in this sense, should it?)`` I would really appreciate your help guys, thanks.

PFont font;
String timesec = "01";
String timemin = "01";
String timeore = "01";
String timeday = "01";

int day;
int intervalday = 21;
int ore;
int intervalore = 24;
int m;
int intervalmin = 60;
int s;
int intervalsec = 60;

void setup()
{
size(300, 300);
font = createFont("Verdana", 30);
background(255);
fill(0);
}

void draw()
{
background(255);

//day TO-DO
day = TODO
timeday = nf(day, 2);
if(day == 0){
println(" ");
intervalday+=10 ;
}
text(timeday, width/5, height/5);

//ore 
ore = intervalore -int(hour());

timeore = nf(ore, 2);
if(ore == 0){
println(" ");
intervalore+=10;}
text(timeore, width/3, height/3);

//minuti
m = intervalmin -int(minute());
timemin = nf(m, 2);
if(m == 0){
println(" ");
intervalmin+=10;}
text(timemin, width/4, height/4);


//secondi
s = intervalsec-int(second());
timesec = nf(s , 2);
if(s == 0){
println(" ");
intervalsec+=10;}
text(timesec, width/2, height/2);
}

Answers

Sign In or Register to comment.