Creative Communities of the World Forums

The peer to peer support community for media production professionals.

Activity Forums Adobe After Effects Expressions After Effects Number Counter – Change Size of Comma Separators

  • After Effects Number Counter – Change Size of Comma Separators

    Posted by Zach Gallant on November 23, 2023 at 9:59 pm

    Hi there,

    I’m animating a few number counters for a client, animating from 10,000 to 100,000 for example.

    I used the following piece of code to build my slider and add the comma separators:

    s = “” + Math.round(effect(“Slider Control”)(“Slider”))
    s.replace(/\B(?=(\d{3})+(?!\d))/g, “,”);

    The numbers are all in 122pt font, but the client wants the comma separators to be smaller, around 73pts in size. Is there a way to modify my expression or add to it to achieve this?

    Thank you!

    Dan Ebberts
    replied 3 months ago
    2 Members · 3 Replies
  • 3 Replies
  • Dan Ebberts

    November 24, 2023 at 3:18 am

    You can’t have per-character formatting with an expression. You could maybe fake it with an expression selector to control scale and tracking, Let me know if you’re interested in how to set that up.

  • Zach Gallant

    November 27, 2023 at 5:38 pm

    That would be great! I’m a bit new to expressions so any workarounds are appreciated!

    Thank you!

  • Dan Ebberts

    November 27, 2023 at 6:38 pm

    Try adding a Scale Animator and set the Scale amount to 60%. To that Animator, also add a Tracking property and set the Tracking amount to -10. Add an Expression Selector and delete the Range Selector. Add this expression to the Expression Selector’s Amount property:

    txt = text.sourceText.value;
    txt[textIndex-1] == "," ? 100 : 0;

    Adjust the Scale and Tracking amount to fit the size of your text.

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