Creative Communities of the World Forums

The peer to peer support community for media production professionals.

Activity › Forums › Adobe After Effects Expressions › Counter counting upto 100,000,000 – Syntax Error

  • Counter counting upto 100,000,000 – Syntax Error

    Posted by Amarjeet Singh on November 17, 2011 at 2:08 pm

    I am trying to create a counter that starts at 10,000 and goes upto maybe 100,000,000.

    I found this tutorial which would allow me to do that but when I paste this code in AFX it gives me a syntax error.
    https://trelhouse.com/article/41/after-effects-tutorial-number-count-over-30000

    Would any of you know why its doing this or if theres another solutions?

    Oh…and I need to use commas as well.
    Any help is much appreciated.
    Thx

    1. Create a Text Layer
    2. Select Effects > Expression Controls > Slider Control
    3. Name the Slider “value”
    4. Select Effects > Expression Controls > Slider Control
    5. Name that slider “multiplier”
    6. Alt-Click on the SourceText and paste this into the expressions field

    s = effect(“value”)(“Slider”);
    m = effect(“multiplier”)(“Slider”); //use for numbers greater than 1 million
    v = s*m; //value of counter

    function digits(Val, Digits)
    {var n = Val.toString(); while (n.length < Digits) n = ‘0’ + n; return n;} h = Math.floor(v); t = Math.floor(h / 1000); m = Math.floor(t / 1000); b = Math.floor(m / 1000); hd = digits(h-t * 1000, 3); td = digits(t-m * 1000, 3); md = digits(m-b * 1000, 3); if (v < 1000) {h} else if (v < 1000000) {t + “,” + hd} else if (v < 1000000000) {m + “,” + td + “,” + hd} else {b + “,” + md + “,” + td + “,” + hd}

    Amarjeet Singh replied 14 years, 10 months ago 2 Members · 3 Replies
  • 3 Replies
  • Dan Ebberts

    November 17, 2011 at 2:49 pm

    One thing I see is that your expression is using smart quotes, which won’t work. Try changing all those to straight quotes.

    Dan

  • Amarjeet Singh

    November 18, 2011 at 12:10 pm

    Guys…anyone…deadline fast approaching

  • Amarjeet Singh

    November 18, 2011 at 3:23 pm

    Dan…you are a star

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