rook
Veteran
Hey guys,
I need a way of animating a digital clock.
Take a look at this clip I did to get an idea of what I mean: (15 seconds in)
http://vimeo.com/3302520
For the clip above I used this script (below) that I found art motionscript.com:
rate = -2;
clockStart = 3604.999;
function padZero
{
if (n < 10) return "0" + n else return "" + n
}
clockTime = clockStart + rate*(time - inPoint);
if (clockTime < 0){
sign = "-";
clockTime = -clockTime;
}else{
sign = "";
}
t = Math.floor(clockTime);
hr = Math.floor(t/3600);
min = Math.floor((t%3600)/60);
sec = Math.floor(t%60);
ms = clockTime.toFixed(3).substr(-3);
sign + padZero(hr) + ":" + padZero(min) + ":" + padZero(sec) + "." + ms
My problem is that I had to mask out the first set of numbers and set the clock with a value like "3604.999".
The issue is that for the next graphic I need to have a lot of layers (100+) all ticking away at different times. Adding the script to each, masking out the first two digits and setting the time seems to be a poor work choice.
Is there a way of modifying this script to lose the first digits? A better script?
A preset to apply the script to all layers and randomize the time value would be awesome but I don't even know where to begin to do that.
I hope I am clear here but if I make no sense let me know and I'll clarify.
Any ideas are appreciated.
Thanks peeps.
I need a way of animating a digital clock.
Take a look at this clip I did to get an idea of what I mean: (15 seconds in)
http://vimeo.com/3302520
For the clip above I used this script (below) that I found art motionscript.com:
rate = -2;
clockStart = 3604.999;
function padZero
if (n < 10) return "0" + n else return "" + n
}
clockTime = clockStart + rate*(time - inPoint);
if (clockTime < 0){
sign = "-";
clockTime = -clockTime;
}else{
sign = "";
}
t = Math.floor(clockTime);
hr = Math.floor(t/3600);
min = Math.floor((t%3600)/60);
sec = Math.floor(t%60);
ms = clockTime.toFixed(3).substr(-3);
sign + padZero(hr) + ":" + padZero(min) + ":" + padZero(sec) + "." + ms
My problem is that I had to mask out the first set of numbers and set the clock with a value like "3604.999".
The issue is that for the next graphic I need to have a lot of layers (100+) all ticking away at different times. Adding the script to each, masking out the first two digits and setting the time seems to be a poor work choice.
Is there a way of modifying this script to lose the first digits? A better script?
A preset to apply the script to all layers and randomize the time value would be awesome but I don't even know where to begin to do that.
I hope I am clear here but if I make no sense let me know and I'll clarify.
Any ideas are appreciated.
Thanks peeps.