Expression to format a number as currency in After Effects

Requires After Effects 2020 or later.

If the expression isn't working go to: File > Project Settings > Expressions and make sure the dropdown is set to: Javascript

/**
* The following expression will format a number variable as currency
*/
var num = [YOUR NUMBER HERE];
num.toLocaleString("en-GB", { style: "currency", currency: "GBP", currencyDisplay: "narrowSymbol"});

Example usage:

/**
* Create a new text layer and set it to 200
* Apply this to the Source Text property of the text layer
*/
var num = parseFloat(text.sourceText);
num.toLocaleString("en-GB", { style: "currency", currency: "GBP", currencyDisplay: "narrowSymbol"});

More advanced examples:

Create a currency counter in after effects

Note: For this example, you will first need to do the following:

  1. Create a text layer
  2. Add a slider control to your text layer
  3. Add the following expression to the Source Text Value
/**
 * NOTE: Change GBP for the currency code of your choice e.g: USD
 **/
var num = parseFloat(effect("Slider Control")("Slider"));
num.toLocaleString("en-GB", { style: "currency", currency: "GBP", currencyDisplay: "narrowSymbol"});

Create a currency counter in after effects without decimal places

Note: For this example, you will first need to do the following:

  1. Create a text layer
  2. Add a slider control to your text layer
  3. Add the following expression to the Source Text Value
/**
 * NOTE: Change GBP for the currency code of your choice e.g: USD
 **/
var num = parseInt(effect("Angle Control")("Angle"));
num.toLocaleString("en-GB", { style: "currency", currency: "GBP", minimumFractionDigits: 0, currencyDisplay: "narrowSymbol"});

Related Video: