Creative Communities of the World Forums

The peer to peer support community for media production professionals.

Activity Forums Adobe After Effects Expressions Timer in increments of 3

  • Timer in increments of 3

    Posted by Lili Reed on May 12, 2016 at 9:59 pm

    I’ve got this expression on the source text of a text layer, a timer ascending in increments of one second. It works just fine, but I need it to increment every three seconds, so it will show, 00:00 – 00:03 – 00:06 – 00:09… etc.
    How can I modify this?
    Of course I still need the seconds to go up to 59 for every minute, not 99.
    Any help is greatly appreciated!
    Thanks
    Lili

    rate = 1;
    clockStart = 00;

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

    clockTime = Math.max(clockStart + rate*(time - inPoint),0);

    t = Math.floor(clockTime);
    min = Math.floor((t%3600)/60);
    sec = Math.floor(t%60);
    min + ":" + padZero(sec)

    Lili

    Lili Reed replied 10 years ago 2 Members · 2 Replies
  • 2 Replies
  • Dan Ebberts

    May 12, 2016 at 11:00 pm

    I doubt this is the most efficient way to do it, but you could change this line:

    sec = Math.floor(t%60);

    to this:

    sec = Math.floor(Math.floor(t%60)/3)*3;

    Dan

  • Lili Reed

    May 16, 2016 at 4:20 pm

    Thanks Dan, that works great.

    Lili

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