How to create a number counter with commas in After Effects

If you’re looking to create an After Effects number counter with commas then chances are you’ve found countless posts and forum articles explaining how to produce the effect with a bunch of complicated expressions and text layers.

Perhaps the most succinct approach to creating a number counter with commas in After Effects is to do the following:

Note: this will only work with After Effects CC 2020 and above, you also need to go to: File > Project Settings and make sure “Javascript” is selected in the drop down of the Expression tab

  • Create a new text layer
  • Add an angle control effect to the text layer
  • Alt-Click the “Source Text” value of the text layer to add an expression
  • Add the following expression:

var num = parseFloat(effect(“Angle Control”)(“Angle”)); num.toLocaleString(“en-GB”);

Then, whenever you change the angle control to be over 1000, the text layer will update and format the number as: 1,000.

Oh, and the reason an Angle Control is used rather than a slider is because sliders come with a maximum value of 1 Million, whereas Angle controls don’t.

If you’d like to only include whole numbers in the counter, without the decimals then change the expression to:

var num = parseInt(effect(“Angle Control”)(“Angle”)); num.toLocaleString(“en-GB”);

The parseInt option formats the number as an integer rather than a floating point number.

Creating a currency counter in After Effects

The .toLocaleString() function comes with a host of additional options you can use to format numbers too! One of these options is currency, so to create a currency counter in After Effects you can follow the same instructions as above but change the expression to be:

var num = parseFloat(effect(“Angle Control”)(“Angle”)); num.toLocaleString(“en-GB”, { style: “currency”, currency: “GBP”, currencyDisplay: “narrowSymbol”});

What’s more, you can also choose any currency you like - all you have to do is change GBP to be another currency code like: EUR or USD for example, and the function will apply the correct formatting for you.

What about a sliding number counter effect instead?

That approach is all well and good, but what happens if you need a nice sliding number counter animation rather than one that just changes the numbers?

Well, that’s where the brand new Numero After Effects script comes in! The brand new beta version of the script now allows you to create a sliding number counter with commas and decimals should you require them. Allowing you to create an effect like this at the touch of a button:

sliding number counter with commas and decimals

The original Numero script was designed to specifically create sliding number counters, much like odometers or mileometers, in After Effects. These counters, out in the real world, never usually have decimal points or commas, which is why the script has never included them before.

Now however, the script allows you to choose whether or not to include commas or decimals simply by writing which you’d like to appear in the boxes. So for example, if you want to create an After Effects number counter with commas that counts up to 1000, all you’d need to do is write: 1,000 in the “count to” box like so:

<img src=”/images/blog/numero-counter/counter-after-effects-with-comma.jpg” alt=”After effects number counter with comma” width=”600” height=”167 />

If you want to produce an odometer effect instead, without the comma, you’d just write 1000 in the box. The script recognises when commas and decimals are included in the boxes and will add them automatically, if no commas or decimals are present then the script will create a standard odometer effect instead.

Take a look at the Numero After Effects script product page for more information.

What does a beta version mean?

Beta versions are basically versions of code that may still have bugs or errors that need to be ironed out - they’re about 99% of the way there, it just needs a lot of people to test it to make sure that last 1% doesn’t have any bugs in it.

As such when you buy the Numero script you’ll get two versions: the main version that just creates an odometer counter, AND the beta version of the script that will allow you to create an after effects number counter with commas and decimals.

As the beta version is still being tested, if you spot any errors or bugs then it’s important to email [email protected]

Start saving time in After Effects

Made by Loop creates After Effects resources that help
motion designers like you save time.

View our time saving scripts for After Effects