Format Numbers in After Effects

How to format numbers in After Effects?

    1. Create a text layer.
    2. Add a Slider Control to the text layer and rename it to Number.
    3. Alt-click on the Source Text property and paste the expressions below.
// slider with a number
var number = parseFloat(effect("Number")("ADBE Slider Control-0001"))
var multiplier = 1; // change the value to 10, 100 etc. 
number = number * multiplier;
var prefix = "$"; // sign before the number
// sign between numbers (you can put a space or comma)
var separator = "."; 
var postfix = ""; // sign after the number

var string = number.toFixed(0)  + "";

"$" + 
string.replace(/(d)(?=(ddd)+([^d]|$))/g, '$1' + 
separator) + postfix;
  1. Create 2 keyframes on the slider with 0 and 1000000 values.

How does it work?

The expression uses a regular expression to search for the number pattern and modifies it. You can learn more about regular expressions at https://en.wikipedia.org/wiki/Regular_expression

How to make a number bigger than 1,000,000?

Change the multiplier variable to 10, 100, etc.

How to change the dollar sign?

Change the prefix variable to any symbol, word or leave it blank like this “”.

How to add a word after the number?

Change the postfix variable.

-50%
-50%
00hrs : 00mins : 00sec
Happy HolidaysSale sitewide
Shop now

Get 5% off when you sign up

By subscribing you agree to your email being stored and used to receive the emails in accordance to our Privacy Policy
descount