Activity › Forums › Adobe After Effects Expressions › Countdown(up) to newyear
-
Countdown(up) to newyear
Posted by Bas V breugel on December 19, 2012 at 4:40 pmI am searching the internet for an expression for a text layer to go from 23:50:00 to 23:59:59 (1 second before midnight)
Al the expression i could find are counting down from 10 min to 0 seconds.
Any suggestions? thanks a lot!
Davis Lindsay replied 13 years, 4 months ago 3 Members · 3 Replies -
3 Replies
-
Dan Ebberts
December 19, 2012 at 5:37 pmThis should work:
rate = 1;
clockStart = (23*60 + 50)*60;
clockStop = (23*60 + 59)*60 + 59;function padZero(n){
if (n < 10) return “0” + n else return “” + n
}clockTime = Math.min(clockStart + rate*(time – inPoint),clockStop);
t = Math.floor(clockTime);
hr = Math.floor(t/3600);
min = Math.floor((t%3600)/60);
sec = Math.floor(t%60);
padZero(hr) + “:” + padZero(min) + “:” + padZero(sec)Dan
-
Bas V breugel
December 19, 2012 at 5:57 pmWow Dan, that’s exactly what i was looking for! Thank you so much!
-
Davis Lindsay
December 19, 2012 at 6:15 pmHello,
Here’s a solution that will get you from 23:50:00 to 24:09:59 using a text layers source text.
You can also use the Text >Timecode Effect if you can handle the default font.
Set your Time Source to custom:
Time Units = 60
Starting Frame = 5148000fps = (1/thisComp.frameDuration);
spm = 60/fps;
fpm = fps*spms = Math.floor(Math.floor(time)%fpm);
m = Math.floor(Math.floor(time)/fpm);if ((s>9) && (m<10)){
"11"+":"+(50+m)+":"+s
} else if ((s<=9) && (m<10)){
"11"+":"+(50+m)+":0"+s
} else if ((s<=9) && (m>=10)){
"12"+":0"+(m-10)+":0"+s
} else if ((s>9) && (m>=10) && (m<20)){
"12"+":0"+(m-10)+":"+s
}Prepare for today and you’ll survive, prepare for tomorrow and you will thrive.
Reply to this Discussion! Login or Sign Up