Creative Communities of the World Forums

The peer to peer support community for media production professionals.

Activity Forums Adobe After Effects Expressions Another Countdown Question

  • Another Countdown Question

    Posted by Highgain on February 23, 2007 at 2:51 am

    In using the below formula, how do I adjust it to countdown NOT showing minetes but past 60 on the seconds. Say starting at 87:00 secs and counting down. I’ve played with it abit but just can’t get the formula right to do this. Any help is appreciated.

    //countdown clock in miliseconds
    ClockStart = 20; //Start time in minutes
    start = ClockStart*60; //start time in seconds
    compTime = start – time;
    eTime = Math.floor(compTime);
    csec = Math.floor((compTime – eTime)*100);
    ms1 = Math.floor(csec/10);
    ms2 = csec%10;
    hr = Math.floor(eTime/3600);
    h1 = Math.floor(hr/10);
    h2 = hr%10;
    min = Math.floor((eTime – hr*3600)/60);
    m1 = min;
    m2 = min%10;
    sec = eTime – hr*3600 – min*60;
    s1 = Math.floor(sec/10);
    s2 = sec%10;
    m1 + ‘:’ + s1 + s2 + ‘.’ + ms1 + ms2

    Darren Hardaway replied 17 years, 3 months ago 4 Members · 4 Replies
  • 4 Replies
  • Dan Ebberts

    February 23, 2007 at 2:25 pm

    Something like this maybe:

    clockStart = 120; // start time in seconds
    clockTime = clockStart – time;
    sec = Math.floor(clockTime).toString();
    ms = Math.floor((clockTime%1)*100).toString();
    if (ms.length < 2) ms = "0" + ms; sec + ":" + ms Dan

  • Highgain

    February 23, 2007 at 3:22 pm

    I’ve seen very few kudo’s in these threads when a solution is provided and I don’t want to be one to add to that. So KUDO’s to ya for the perfect solution!

  • Marcelino25

    February 26, 2007 at 4:40 pm

    I would like the expression to start working 2 seconds into the composition. If someone can help me out that would be much appreciated. Thanks

  • Darren Hardaway

    April 23, 2009 at 4:16 pm

    if anyone is interested in the last comment on this post, I think the answer is a little something like this
    clockStart = 0; // start time in seconds
    timeToStart = 2
    clockTime = clockStart + (time – timeToStart);
    sec = Math.floor(clockTime).toString();
    ms = Math.floor((clockTime%1)*100).toString();
    if(time>timeToStart==true){
    if (ms.length < 2) ms = "0" + ms; sec + ":" + ms } else(value) Oh I changed the timer to count up, not down, to fix change line one's value to 120, and change line two's + to a - and if you want it to Stop at a specific time, flip the inequality symbol.

We use anonymous cookies to give you the best experience we can.
Our Privacy policy | GDPR Policy