AE ENHANCERS

Expressions/Scripts/Presets
It is currently Sun May 19, 2013 1:52 pm

All times are UTC - 8 hours [ DST ]




Post new topic Reply to topic  [ 3 posts ] 
Author Message
 Post subject: Countdown expression help
PostPosted: Wed Nov 05, 2008 1:33 pm 
Offline

Joined: Sun Feb 17, 2008 10:59 pm
Posts: 2
I'm using Dan Ebbert's script:

Code:
rate = -2;
clockStart = 3604.999;

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)


What I'd like to do is add days and make the hours cycle at 24. My desired output is:
18 : 23 : 59 : 59
(days hours minutes seconds)

I can't figure this out at all. Any help or pointers will be appreciated.


Top
 Profile  
 
 Post subject: Re: Countdown expression help
PostPosted: Wed Nov 05, 2008 7:55 pm 
Offline

Joined: Sat Jun 26, 2004 10:01 am
Posts: 297
Location: Folsom, CA
Play around with this:

Code:
rate = -2;
clockStart = 86404.999;

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);
day = Math.floor(t/(86400))
hr = Math.floor((t%86400)/3600);
min = Math.floor((t%3600)/60);
sec = Math.floor(t%60);
sign + day + ":" + padZero(hr) + ":" + padZero(min) + ":" + padZero(sec)



Dan

_________________
http://www.motionscript.com


Top
 Profile  
 
 Post subject: Re: Countdown expression help
PostPosted: Thu Nov 06, 2008 11:13 am 
Offline

Joined: Sun Feb 17, 2008 10:59 pm
Posts: 2
Thanks Dan, this worked great. I linked the rate to a slider and was able to control the speed just as I liked too.


Top
 Profile  
 
Display posts from previous:  Sort by  
Post new topic Reply to topic  [ 3 posts ] 

All times are UTC - 8 hours [ DST ]


Who is online

Users browsing this forum: No registered users and 1 guest


You cannot post new topics in this forum
You cannot reply to topics in this forum
You cannot edit your posts in this forum
You cannot delete your posts in this forum
You cannot post attachments in this forum

Search for:
Jump to:  
Powered by phpBB © 2000, 2002, 2005, 2007 phpBB Group