# Creative Communities of the World Forums

The peer to peer support community for media production professionals.

Forums Adobe After Effects Technique for Animated Number Countdown with Commas

• # Technique for Animated Number Countdown with Commas

• Hi All,

Ran into this issue and combined like two techniques to get a really easy solution – thought I’d share it.

To get a number to countdown (from say 256,000 to 152,000 with commas, no decimal) follow these steps. (I didn’t write most of the expression, got it from a website)

1. Create an empty text layer.

2. Go to Effects -> Expression Controls -> Slider Control

3. Twirl Down the Text Layer and ‘alt (option on mac) + click’ Text Source to open expression editor.

4. Enter the expression below.

5. Use the slider control effect to animate number. Enter the actual value instead of using the slider for numbers larger than one hundred. Simply key frame the effect and use the character editor to format the text. (Goes as high as 1,000,000)

Expression:

var num = effect(“Slider Control”)(“Slider”)
num = Comma(num);
[num]

function Comma(number)
{
number = ” + Math.round(number);
if (number.length > 3)
{
var mod = number.length % 3;
var output = (mod > 0 ? (number.substring(0,mod)) : ”);
for (i=0 ; i < Math.floor(number.length / 3); i++)
{
if ((mod == 0) && (i == 0))
output += number.substring(mod+ 3 * i, mod + 3 * i + 3);
else
output+= ‘,’ + number.substring(mod + 3 * i, mod + 3 * i + 3);
}
return (output);
}
else return number;
}

• Very nice, saved to useful expressions folder.

Johnny Cuevas, Editor
Thinkck.com

“I have not failed 700 times. I have succeeded in proving that those 700 ways will not work. When I have eliminated the ways that will not work, I will find the way that will work.”
—THOMAS EDISON on inventing the light bulb.

• ### Roland R. Kahlenberg

February 9, 2012 at 6:31 pm

Thanks for sharing Randy.

Cheers
RoRK

Intensive AE & Mocha Training in Singapore and Malaysia
Adobe ACE/ACI (version 7) & Imagineer Systems Inc Approved Mocha Trainer

• Thanks! This share helped me a lot!

• Is there a way to do 1,000,000+ ? I need a population counter….

• my problem is the same as someone else posted; need to show a population countup from 0 or 100,000 to over 1 billion or over.

• This is probably too late but I just saw this post now, to go over a million, just multiply the slider value in the first line of the expression like so-

var num = effect(“Slider Control”)(“Slider”) * 100 (or whatever number you want)

• This is very useful, thanks for sharing!
In Italy we use commas instead of dots, so I would need to place the comma only before the last (or last two) digit.
I tried this way

var num = effect(“Slider Control”)(“Slider”)
num = Comma(num);
[num]

function Comma(number)
{
number = ” + Math.round(number);
if (number.length > 2)
{
var mod = number.length % 1;
var output = (mod > 0 ? (number.substring(0,mod)) : ”);
for (i=0 ; i < Math.floor(number.length / 1); i++)
{
if ((mod == 0) & (i == 0))
output += number.substring(mod+ 1 * i, mod + 1 * i + 1);
else
output+= ‘,’ + number.substring(mod + 1 * i, mod + 1 * i + 1);
}
return (output);
}
else return number;
}

but I get a comma after every digit.
Any idea?
Thank you!

• Thank you for a simple and lean solution. Brilliant!

Arvid Eriksson
https://www.arvideriksson.com/

• Hi,

This expression actually adds a least 10 numbers behind the comma. How to avoid that?

Best, Stig

Viewing 1 - 10 of 27 posts

Log in to reply.

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