ADOBE AFTER EFFECTS: Forum Expressions Tutorials Creative Cloud

FX Expression for Days Hours Min Sec Countdown?

COW Forums : Adobe After Effects Expressions

<< PREVIOUS   •   FAQ   •   VIEW ALL   •   PRINT   •   NEXT >>
Sara Martinez
FX Expression for Days Hours Min Sec Countdown?
on Nov 12, 2016 at 7:57:04 am

I have been looking at tutorials and searching the web for days trying to find an After Effects expression that will help me to count down from a specific date, similar to what this site does: https://www.timeanddate.com/countdown/generic?iso=20161118T00&p0=155&font=c...

I want to do it in After Effects because I need to export it in MP4. I have already seen something similar to what I need here: https://www.facebook.com/BuzzFeed/videos/10155300775200329/

If anyone could help me with an expression or point me to a plug in or resource that could assist me in accomplishing this I would greatly appreciate it. I am very new at expressions and I've been trying to modify some I've found with hours and minutes only but I can't figure it out to get days and hours too. Thank you in advance for any insight!!


Return to posts index

Dan Ebberts
Re: FX Expression for Days Hours Min Sec Countdown?
on Nov 13, 2016 at 5:48:23 am

This should be close:


function padZero(n){
s = "" + n;
if (s.length < 2) return ("0"+s);
return s;
}
dayStart = 5;
hrStart = 0;
minStart = 0;
secStart = 0;

clockRate = 10;

totalStartSec = ((dayStart*24 + hrStart)*60 + minStart)*60 + secStart;
curTotalSec = totalStartSec - Math.round((time - inPoint)*clockRate);

curDay = Math.floor(curTotalSec/(24*3600));
curHr = Math.floor((curTotalSec%(24*3600))/3600);
curMin = Math.floor((curTotalSec%3600)/60);
curSec = curTotalSec%60;

padZero(curDay) + " " + padZero(curHr) + " " + padZero(curMin) + " " + padZero(curSec)



Dan



Return to posts index

Sara Martinez
Re: FX Expression for Days Hours Min Sec Countdown?
on Nov 15, 2016 at 2:39:19 am

Thank you so much Dan!! You're incredibly kind. This worked wonderfully. My only set back now is the rendering, but the script is exactly what I needed and it works great.


Return to posts index


Elvis Muchara
Re: FX Expression for Days Hours Min Sec Countdown?
on Jul 27, 2018 at 4:17:17 pm

Hi, how can I change the time in this expression, say I want it to start at 05:10:15 and continue?


Return to posts index

Dan Ebberts
Re: FX Expression for Days Hours Min Sec Countdown?
on Jul 27, 2018 at 4:35:22 pm

I'm not sure what you mean exactly, but maybe like this:


function padZero(n){
s = "" + n;
if (s.length < 2) return ("0"+s);
return s;
}

hrStart = 5;
minStart = 10;
secStart = 15;

clockRate = 1;

totalStartSec = ((hrStart)*60 + minStart)*60 + secStart;
curTotalSec = totalStartSec - Math.floor((time - inPoint)*clockRate);

curHr = Math.floor((curTotalSec%(24*3600))/3600);
curMin = Math.floor((curTotalSec%3600)/60);
curSec = curTotalSec%60;

padZero(curHr) + ":" + padZero(curMin) + ":" + padZero(curSec)



Dan



Return to posts index

<< PREVIOUS   •   VIEW ALL   •   PRINT   •   NEXT >>
© 2018 CreativeCOW.net All Rights Reserved
[TOP]