Activity › Forums › Adobe After Effects Expressions › 5 Minute Countdown
-
5 Minute Countdown
Posted by Stephen Burton on July 21, 2008 at 8:36 pmI’m trying to make a countdown which counts down from 5:00 Minutes to 0:00.
I want it to work in actual seconds, like a normal clock.
I’ve tryed Effect/Text/Numbers.
I’ve messed with all the things for weeks and can’t figure it out.
Searched the internet and still can’t find what i need.Can anyone help me?
Tutorial? Anything?Thanks,
StephenVadik Zhuk replied 7 years, 5 months ago 24 Members · 63 Replies -
63 Replies
-
Dan Ebberts
July 21, 2008 at 9:26 pmTry pasting this into the source text property of a text layer:
rate = -1;
clockStart = 300;function padZero(n){
if (n < 10) return "0" + n else return "" + n } clockTime = Math.max(clockStart + rate*(time - inPoint),0); t = Math.floor(clockTime); min = Math.floor((t%3600)/60); sec = Math.floor(t%60); min + ":" + padZero(sec) Dan -
Stephen Burton
July 22, 2008 at 12:08 amWhat about for a 2 minute one?
WHat would i change?
that one worked great! THANKS!
-
Stephen Burton
July 22, 2008 at 4:56 amThanks Dan.
You’ve been incredibly helpful.
Exactly what i needed to know!!
You Rock!
-
Kjell Nygren
August 2, 2008 at 4:54 pmI’ve been trying to get this expression to show milliseconds and I just can’t get it to work. I’ve tried some other expressions that do it, but they all seem to break. I have to create a 45min 30sec countdown, but I want it to show milliseconds as well.
Please help
Thanks,
Kjell -
Dan Ebberts
August 2, 2008 at 5:28 pmTry this:
rate = -1;
clockStart = 2730;function padZero(n){
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); min = Math.floor((t%3600)/60); sec = Math.floor(t%60); ms = clockTime.toFixed(3).substr(-3); sign + padZero(min) + ":" + padZero(sec) + "." + ms Dan -
John Barata
January 20, 2009 at 7:36 pmHi Dan,
Great post. I tried it out and perfect. The only problem is that is doesn’t work for what I need and I can’t figure out what to change.
I need a clock that counts up normally that shows hr:min:sec starting at whatever time.
Is there a simple fix to make this work?
-
Dan Ebberts
January 20, 2009 at 9:00 pmThis source text expression should work. Just set the clockStart variable to the start time (in seconds).
rate = 1;
clockStart = 0;function padZero(n){
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); sign + padZero(hr) + ":" + padZero(min) + ":" + padZero(sec) Dan -
John Barata
January 21, 2009 at 4:53 pmThanks for your help Dan but before I read your post I stumbled across this one
addedSec = thisComp.layer(“Controller”).effect(“Seconds”)(“Slider”);
addedMin = thisComp.layer(“Controller”).effect(“Minutes”)(“Slider”)*60;
addedHr = thisComp.layer(“Controller”).effect(“Hours”)(“Slider”)*3600;
addedTime = addedSec + addedMin + addedHr;sec = Math.floor(time + addedTime) * thisComp.layer(“Controller”).effect(“Time Multiplier”)(“Slider”);
minvar = Math.floor(sec/60);
hrvar = Math.floor(sec/3600);
sechrvar = Math.floor(sec – (3600*hrvar));
minhrvar = Math.floor(sechrvar/60);if(sec<0){
"Err: Negative Time"
}else{if ((sec - 10) < 0) { ":0" + sec } else { if ((sec - 60) < 0) { ":" + sec }else{ if (((sec/60)>1) && ((sec – minvar*60)<10) && (sec<3600)) {
(minvar) + ":0" + (sec - minvar*60)}else{
if ((sec - 60) < 0) { ":" + sec }else{ if ((sec/60) == 1) { (minvar) + ":00" }else{ if (((sec/60)>1) && ((sec – minvar*60)>=10) && (sec<3600)) {
(minvar) + ":" + (sec - minvar*60)
}else{if((sec - 3600*hrvar) == 0){
(hrvar) + ":00:00"
}else{if(((sec - 3600) > 0) && ((sec – (3600*hrvar) – (minhrvar*60)< 10)) && (minhrvar<10)){ (hrvar) + ":0" + minhrvar + ":0" + (sechrvar - minhrvar*60) }else{ if(((sec - 3600) > 0) && ((sec – (3600*hrvar) – (minhrvar*60)) >=10) && (minhrvar < 10)){ (hrvar) + ":0" + minhrvar + ":" + (sechrvar - minhrvar*60) }else{ if(((sec - 3600) > 0) && ((sec – (3600*hrvar) – (minhrvar*60)) < 10) && (minhrvar >= 10)){
(hrvar) + “:” + minhrvar + “:0” + (sechrvar – minhrvar*60)
}else{if(((sec – 3600) > 0) && ((sec – (3600*hrvar) – (minhrvar*60)) >=10) && (minhrvar >= 10)){
(hrvar) + “:” + minhrvar + “:” + (sechrvar – minhrvar*60)
}else{sec}}}}}}}}}}}}
I can’t remember if you had written it on another forum but it worked great.
But once again thank you for your help either way. It’s great to know that there are people out there always willing to help.
Cheers
-
Gabriel Constantine
January 31, 2009 at 2:00 pmGreat one Dan, thx
Is there a way to have this countdown display in absolute seconds (300, 299, 298…) rather then in a clock format (5:00, 4:59..)?
Reply to this Discussion! Login or Sign Up