ADOBE AFTER EFFECTS: Forum Expressions Tutorials Creative Cloud

Countdown from 90 seconds. Not 1:30

COW Forums : Adobe After Effects Expressions

<< PREVIOUS   •   FAQ   •   VIEW ALL   •   PRINT   •   NEXT >>
robert gilchrist
Countdown from 90 seconds. Not 1:30
on Jun 28, 2018 at 1:45:25 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 &lt; 10) return "0" + n else return "" + n
}

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

if (clockTime &lt; 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)


Return to posts index

Dan Ebberts
Re: Countdown from 90 seconds. Not 1:30
on Jun 28, 2018 at 1:06:09 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



Return to posts index

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