Skip to main content
steve456
Participant
March 3, 2019
Answered

Putting a comma in an after effects counter

  • March 3, 2019
  • 4 replies
  • 22037 views

Hi all,

I'm trying to make a simple counter in After Effects (which I did), but I can't seem to figure out how to put a comma after the number reaches past 100,000. I already tried what is out there within the YouTube community and other forums. I just can't seem to get it to work. Any suggestions?

This topic has been closed for replies.
Correct answer dj.summitt

Just copied this from a project I'm working on. If not working with dollars just remove the $ from text before.

countTotal=57000;

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; } textBefore+s+textAfter;

4 replies

Participating Frequently
December 18, 2020

Made by Loop's Numero After Effects script  now creates sliding number counters with commas and decimals if that's the effect you're looking for?

steve456
steve456Author
Participant
March 3, 2019

This worked perfectly, thank you so much!

Community Expert
March 3, 2019

You should search for Dan Ebberts universal timer and save it as an animation preset. Dan Ebberts's Universal Counter.

Participant
September 17, 2019
Thanks for a great help!
dj.summitt
dj.summittCorrect answer
Inspiring
March 3, 2019

Just copied this from a project I'm working on. If not working with dollars just remove the $ from text before.

countTotal=57000;

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; } textBefore+s+textAfter;

steve456
steve456Author
Participant
March 3, 2019

Thank you! I will try this!