Creative Communities of the World Forums

The peer to peer support community for media production professionals.

Activity Forums Adobe After Effects Expressions 5 Minute Countdown

  • Tufekoa Durcanof

    January 26, 2010 at 8:25 am

    Hi,

    First of all thank you very much Dan for this thread it’s really very helpful for the expression dummies like me. 🙂

    I am doing a countdown for 5:00 and am having an error message on line 6 like 2 other people.

    I am using your first expression: (on a text layer on which i wrote 5:00)

    rate = -1;
    clockStart = 300;

    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) I can't see what the problem is.
    rate = -1;
    clockStart = 300;

    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)

  • Steven Knight

    November 26, 2010 at 3:44 am

    Hi Dan,

    Thank you for these script tips.

    One problem I’m come across is the countdown eventually falling out of synch; apparently due to the 23.976 frame rate — it works like a charm at 24 fps.

    Any help would be greatly appreciated.

    Thank you for your time.

    Cheers.

    S.J.

    rate = -1;
    clockStart = 3600;

    function padZero(n){
    if (n &lt; 10) return "0" + n else return "" + n
    }

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

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

  • Kay Rinne

    June 9, 2011 at 3:04 pm

    I am getting the Line 6 error as well.

    After Effects warning: Expected: )
    Expression disabled

    Error occurred at Line 6.
    Comp: ‘Comp 2’
    Layer: 1 (‘5:00’)
    Proprty: ‘Positon’

    Obviously its looking to close a parentheses somewhere?

    line 6 should correspond to the if statement and the “n” var opens but does not close?

    using this code:

    rate = -1;
    clockStart = 300;

    function padZero(n){
    if (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)

  • Dan Ebberts

    June 9, 2011 at 3:36 pm

    Somewhere along the line the padZero function got messed up, probably because of the “<“.

    It should look like this:


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

    Dan

  • Kay Rinne

    June 10, 2011 at 5:02 pm

    thanks that helped!

  • Karl Pouillot

    November 7, 2011 at 11:26 pm

    Bonsoir,

    Merci pour ton aide tout d’abord. After Effects est loin d’être facile à prendre en main. Et c’est bien la première fois que je vois un logiciel comme celui-ci qui demande de savoir programmer!

    Bref, j’aurais besoin à nouveau de tes lumières…
    Cette expression ci dessous marche très bien mais j’aimerais rajouter les millisecondes dans le décompte, histoire d’avoir un truc un peu plus dynamique.

    Tu crois que tu pourrais me filer un coup de pouce?

    Merci d’avance!

    Bonne nuit

    rate = -1;
    clockStart = 1440;

    function padZero(n){
    if (n &lt; 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);
    mil = Math.floor(t%500)
    min + ":" + padZero(sec)

  • Dan Ebberts

    November 7, 2011 at 11:53 pm

    S’il vous plaît, essayez ceci:


    rate = -1;
    clockStart = 1440;
    function padZero(n){
    return ((n < 10) ? "0" : "") + 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) + clockTime.toFixed(3).substr(-4)

    Dan

  • Karl Pouillot

    November 8, 2011 at 9:16 pm

    Thank you for your help.

    But i’ve done a mistake. I need tenth second, not thousandth second.
    And there is an another problem on the digital display. There is only “on point” between the second and the thousandth second but we need two points like what we have between minute and second.

    Could you help for that?

    Thank you.

    PS : Sorry for my english, i m a little bit rusty…

  • Dan Ebberts

    November 8, 2011 at 11:58 pm

    Try this:


    rate = -1;
    clockStart = 1440;
    function padZero(n){
    return ((n < 10) ? "0" : "") + 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) + ":" + clockTime.toFixed(1).substr(-1)

    Dan

  • Karl Pouillot

    November 9, 2011 at 12:22 am

    It’s perfect but do you know how i could save correctly this composition to read it on quicktime or VLC?
    As soon as i want to save it, the final composition run during 30 sec and stop itself. It doesn t make sense, the countdown last 24 minutes. Any solution?

    Thank you!

Page 3 of 7

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