Activity › Forums › Adobe After Effects Expressions › Expression for Digital 24 Hours clock
-
Expression for Digital 24 Hours clock
Posted by Gilben on October 14, 2005 at 1:02 pmI am looking for a smarter way to build a count down 24 hours clock.
I couldnt find the right plugin for this (the text number effect – is not good for 24 hours count down and has no 100/th of a sec.)
Doing this with key frames seem to me no too effecient.I was thinking maybe anyone of you is familiar with plug in or if it could be done with animation Expression.
Tnx for any help
GilWill Gallow replied 9 years, 5 months ago 7 Members · 13 Replies -
13 Replies
-
Dan Ebberts
October 14, 2005 at 5:30 pm24 hour count down clock (expression for text layer source text):
// 24 hour count down clock
beginHr = 23;
beginMin = 59;
beginSec = 59;
beginHun = 0;beginTime = (beginHr*60 + beginMin)*60 + beginMin + beginHun/100;
function digits(myVal,myNumDigits){
var s = myVal.toString();
while (s.length < myNumDigits) s = '0' + s; return s; } currTime = beginTime - time; hr = digits(Math.floor(currTime/3600),2); min = digits(Math.floor((currTime%3600)/60),2); sec = digits(Math.floor(currTime)%60,2); hun = digits(Math.floor(currTime%1*100),2); hr + ":" + min + ":" + sec + "." + hun Dan -
Dan Ebberts
October 14, 2005 at 6:22 pmYou’d think I’d have learned by now to always try it before posting. This should work better:
beginHr = 3;
beginMin = 0;
beginSec = 1;
beginHun = 0;beginTime = (beginHr*60 + beginMin)*60 + beginSec + beginHun/100;
function digits(myVal,myNumDigits){
var s = myVal.toString();
while (s.length < myNumDigits) s = '0' + s; return s; } currTime = beginTime - time; hr = digits(Math.floor(currTime/3600),2); min = digits(Math.floor((currTime%3600)/60),2); sec = digits(Math.floor(currTime)%60,2); hun = digits(Math.floor(currTime%1*100),2); hr + ":" + min + ":" + sec + "." + hun Dan -
Gilben
October 15, 2005 at 8:02 amDan
Thank you very vewry much for your serious respond.
i will try it your wayi quess i should take some tutorials in expression methods.
thanx alot.
Gil -
Matthewb
March 13, 2006 at 4:18 amDan/Anyone
what is taking place here in your expression:
function digits(myVal,myNumDigits){
var s = myVal.toString();
while (s.length < myNumDigits) s = '0' + s; return s; } i can follow the rest but am having trouble with what "function" is performing (adobe help, wasnt) then waht is the digits command accomplishing... s i take it is getting the length of myVal i think i can figure it from there... just am not sure what is happening at the beginning... i have to write a clock that starts at a specific point and stops at a specific point over a specified period... i.e. clock starts at 30.0 seconds and over 2 second climb to 43.14 seconds. thanks, -
Brandon Mcfarland
August 25, 2011 at 7:08 pmI’m trying to modify this to make a 48 hour countdown. I’ve got the numbers correct, but I want to try and get the numbers under 10 to display with a zero in front of them. Any tips for that? I tried just changing the begin values, but that didn’t work at all (it didn’t mess up the expression at all though, so I left it).
Thanks.beginHr = 48;
beginMin = 00;
beginSec = 00;
beginHun = 00;beginTime = (beginHr*60 + beginMin)*60 + beginSec + beginHun/100;
function digits(myVal,myNumDigits){
var s = myVal.toString();
while (s.length) return s;
}currTime = beginTime - time;
hr = digits(Math.floor(currTime/3600),2);
min = digits(Math.floor((currTime%3600)/60),2);
sec = digits(Math.floor(currTime)%60,2);
hun = digits(Math.floor(currTime%1*100),2);
hr + ":" + min + ":" + sec + "." + hun -
Dan Ebberts
August 25, 2011 at 7:53 pmYou didn’t get the whole expression. Try this:
beginHr = 48;
beginMin = 0;
beginSec = 0;
beginHun = 0;
beginTime = (beginHr*60 + beginMin)*60 + beginSec + beginHun/100;
function digits(myVal,myNumDigits){
s = myVal.toString();
while (s.length < myNumDigits) s = "0" + s;
return s;
}currTime = beginTime - time
hr = digits(Math.floor(currTime/3600),2);
min = digits(Math.floor((currTime%3600)/60),2)
sec = digits(Math.floor(currTime)%60,2);
hun = digits(Math.floor(currTime%1*100),2);
hr + ":" + min + ":" + sec + "." + hun
Dan
-
Brandon Mcfarland
August 25, 2011 at 7:57 pmThat works. Thanks! Now I just have to find a fixed width font that looks decent so it doesn’t look like it’s jumping around as much.
-
Gordon Fales
September 23, 2011 at 3:24 amthanks for posting this.
I want to do the same thing but be able to set a key frame and run it not in real time. For example 20 hours down to 0 in 30 seconds.
Thanks for you help -
Dan Ebberts
September 23, 2011 at 6:25 amI’m not sure what you want to keyframe, but to run it faster than real time, you just need to add a rate variable, like this:
rate = 2400;beginHr = 20
beginMin = 0;
beginSec = 0;
beginHun = 0;
beginTime = (beginHr*60 + beginMin)*60 + beginSec + beginHun/100;
function digits(myVal,myNumDigits){
s = myVal.toString();
while (s.length < myNumDigits) s = "0" + s;
return s;
}
currTime = beginTime - time*rate;
hr = digits(Math.floor(currTime/3600),2);
min = digits(Math.floor((currTime%3600)/60),2);
sec = digits(Math.floor(currTime)%60,2);
hun = digits(Math.floor(currTime%1*100),2);
hr + ":" + min + ":" + sec + "." + hun
That should count down 20 hours in 30 seconds.
Dan
-
Gordon Fales
September 28, 2011 at 6:38 pmDan
Thanks so much for your help I may have an easy job for you
Thanks so much
Gordon
gfales@sbcglobal.net
Reply to this Discussion! Login or Sign Up