Creative Communities of the World Forums

The peer to peer support community for media production professionals.

Activity Forums Adobe After Effects Expressions Animated Numbers with Comma – works for any numbers, positive and negative

  • Animated Numbers with Comma – works for any numbers, positive and negative

    Posted by Andy Kelly on September 19, 2016 at 6:36 pm

    Thought I’d share my expression for animating counting numbers with commas. This inserts commas appropriately for positive and negative numbers with no number size limit.

    First add a slider control to your text layer. Then paste the expression in text source. If your number is less than a million, just use the slider numbers. If it’s more, than set the countTotal to your desired number, and a slider value of 100 will output your number. You can keyframe multiple numbers above a million by taking the number you wish to go to, multiplying it by 100 and dividing by your countTotal.

    You can also add text or characters before or after the number, like “$” for instance.

    countTotal=100;
    textBefore = "$";
    textAfter = "";

    n="" + Math.round(effect("Slider Control")("Slider")*countTotal/100);
    s="";
    for(i=0, l=n.length; i<l; i++){
    if(s && s!="-" && (l-i)%3 ==0)
    s+=",";
    s += n[i];
    }
    textBefore+s+textAfter;

    Andy Kelly replied 9 years, 8 months ago 1 Member · 0 Replies
  • 0 Replies

Sorry, there were no replies found.

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