-
Countdown Timer: millisecond goes into minus numbers
Having trouble with a countdown timer using a slider control, when the milliseconds go below a certain number the final character goes into minus numbers. I am sure it’s a really simple expression change I just can’t work it out. If anyone could help that would be great,
If anyone needs anymore information please shout, thanks!
rateOfSpeed = 1 ;
rateOfSpeedMilli = 100;
clockStartTime = thisComp.layer("Timer Duration").effect("Slider Control")("Slider")*60;function addZero(n) {
if (n<10) return "0" + n else return n;
}clockTimeNumber = Math.floor(clockStartTime - rateOfSpeed*time);
clockTimeNumberMilli = Math.floor(clockStartTime - rateOfSpeedMilli*time);minutes = Math.floor(clockTimeNumber/60);
seconds = clockTimeNumber%60;
milliseconds = clockTimeNumberMilli%100;if (clockStartTime > 0 && time < clockStartTime) {
addZero(minutes) + ":" + addZero(seconds) + ":" + addZero(milliseconds);
} else {"00:00:00"};