Creative Communities of the World Forums

The peer to peer support community for media production professionals.

Activity › Forums › Adobe After Effects Expressions › Need help with simple timer

  • Need help with simple timer

    Posted by Dreman on September 19, 2007 at 6:20 am

    I have a very simple time expression for a 30 sec counter, that works perfectly fine, but would like to have numbers below 10, to have a 0 in front, 10, 09, 08, 07 etc. I’m not a math guy and know even less about javascript. This whole expression thing is brand new to me, but clearly very powerful looking at some examples. Any help would be appreciated. This is what I have right now:

    Math.round
    (31-time)

    I was also wondering if anyone can recommend an AE expression book or website that offers entry level help for rookie’s like myself.

    Thanks
    Dre

    Dreman replied 19 years ago 2 Members · 2 Replies
  • 2 Replies
  • Mike Clasby

    September 19, 2007 at 8:41 am

    I really like Dan’s Universal Counter, very flexible.

    https://www.motionscript.com/design-guide/up-down-clock.html

    His expression, modified for your needs (as I read them) would be this (on Source Text):

    rate = -1;
    clockStart =30;

    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); ms = clockTime.toFixed(3).substr(-3); sign + padZero(sec) Lines 1, 2 and 22 are different. See the page for extensive explanation. Dan's page is a great place, especially the section "Mastering Expressions" for begiining. https://www.motionscript.com/

    And this is a very good introduction:

    https://www.jjgifford.com/expressions/

  • Dreman

    September 19, 2007 at 4:02 pm

    This is awesome. Exactly what I was looking for and motionsctipt.com looks like the answer as well. I can’t tell you have many times I’ve Googled and could not find that site via regular search. So thanks again.

    Really appreciate your time

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