Creative Communities of the World Forums

The peer to peer support community for media production professionals.

Activity Forums Adobe After Effects Expressions Countdown from 90 seconds. Not 1:30

  • Countdown from 90 seconds. Not 1:30

    Posted by Robert Gilchrist on June 28, 2018 at 1:45 am

    Hi team, I am trying to create a time accurate 90 second countdown using expression. This can’t be done with Effect Controls, as it must feed into Element after so it must be script driven. The final look should be 90:00 where the left 2 digits are seconds and the right 2 digits are milliseconds. The script i have been playing with unfortunately gives me 01:30:00. Please see attached script and feedback would be highly appreciated.

    countspeed = 60;
    clockStart = 120 * countspeed * -1;

    function times(n) {
    if (n < 10) return "0" + n else return "" + n
    }

    clockTime = clockStart + countspeed * (time - inPoint);

    if (clockTime < 0) {
    minus = ""; clockTime = -clockTime;
    } else {
    minus = "";
    }

    t = Math.floor(clockTime);
    h = Math.floor(t/3600);
    min = Math.floor((t%3600)/60);
    sec = Math.floor(t%60);
    ms = clockTime.toFixed(3).substr(-3);
    minus + times(h) + ":" + times(min) + ":" + times(sec)

    Dan Ebberts replied 8 years, 2 months ago 2 Members · 1 Reply
  • 1 Reply
  • Dan Ebberts

    June 28, 2018 at 1:06 pm

    Try this:

    clockStart = 90;
    clockTime = Math.max(clockStart – (time-inPoint),0);
    sec = Math.floor(clockTime);
    ms = clockTime.toFixed(2).substr(-2);
    sec + “:” + ms

    Dan

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