## Counting to 100.000.000

8 posts • Page

**1**of**1**### Counting to 100.000.000

Hello everybody,

I'm working on a scientific animation and i need a number to animate from 0 to 100.000.000

pausing at several numbers like 50, 1.000, 10.000 etc...

AE number count only goes up to 30000 and i'm trying to get a dot(.) instead of a comma(,) for the numbers over 1.000...

I found this using google http://trelhouse.com/article/41/after-e ... over-30000

but it doesn't seem to work....

who knows the solution??

Thanks a lot!

T.

I'm working on a scientific animation and i need a number to animate from 0 to 100.000.000

pausing at several numbers like 50, 1.000, 10.000 etc...

AE number count only goes up to 30000 and i'm trying to get a dot(.) instead of a comma(,) for the numbers over 1.000...

I found this using google http://trelhouse.com/article/41/after-e ... over-30000

but it doesn't seem to work....

who knows the solution??

Thanks a lot!

T.

- tonyworks
**Posts:**3**Joined:**06/23/2009, 2:09 am**Location:**Rotterdam, The Netherlands

### Re: Counting to 100.000.000

almost there!

i found this and it counts up to 1.000.000 but i can't get it to count to 1.000.000.000

----

Formatting a number with commas

1. Create a comp. Name it anything you like.

2. Create a new text layer and name it "dummy" (this layer can be turned off; it feeds a number to the final text layer. I haven't found a way around this; please let me know if there's another way).

3. Add a slider to the "dummy" layer (Effects > Expression Controls > Slider Control). After Effects should automatically name the slider control "Slider"

4. Add an expression to Source Text of "dummy" (Animation > Add Expression).

5. Pickwhip the expression to the "Slider" control from step 3.

6. Create a second text layer. This will be the layer that displays the formatted number.

7. Add an expression to Source Text of the new text layer. Replace the code with the following:

var num = thisComp.layer("dummy").text.sourceText;

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;

}

Now try changing the value of the "Slider" control. Your visible text layer should reflect that number, now formatted with commas. Two catches: it only works for integers, and the slider tops out at 1,000,000. You should be able to pickwhip to any propery that contains a number (decimals are rounded off automatically).

i found this and it counts up to 1.000.000 but i can't get it to count to 1.000.000.000

----

Formatting a number with commas

1. Create a comp. Name it anything you like.

2. Create a new text layer and name it "dummy" (this layer can be turned off; it feeds a number to the final text layer. I haven't found a way around this; please let me know if there's another way).

3. Add a slider to the "dummy" layer (Effects > Expression Controls > Slider Control). After Effects should automatically name the slider control "Slider"

4. Add an expression to Source Text of "dummy" (Animation > Add Expression).

5. Pickwhip the expression to the "Slider" control from step 3.

6. Create a second text layer. This will be the layer that displays the formatted number.

7. Add an expression to Source Text of the new text layer. Replace the code with the following:

var num = thisComp.layer("dummy").text.sourceText;

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;

}

Now try changing the value of the "Slider" control. Your visible text layer should reflect that number, now formatted with commas. Two catches: it only works for integers, and the slider tops out at 1,000,000. You should be able to pickwhip to any propery that contains a number (decimals are rounded off automatically).

- tonyworks
**Posts:**3**Joined:**06/23/2009, 2:09 am**Location:**Rotterdam, The Netherlands

- Mylenium
**Posts:**3263**Joined:**02/1/2009, 11:45 am**Location:**Germany**System Specs:**Have, I do!

### Re: Counting to 100.000.000

Thanks Mylenium!

Tony

Tony

- tonyworks
**Posts:**3**Joined:**06/23/2009, 2:09 am**Location:**Rotterdam, The Netherlands

### Re: Counting to 100.000.000

tonyworks wrote:almost there!

i found this and it counts up to 1.000.000 but i can't get it to count to 1.000.000.000

----

Formatting a number with commas

1. Create a comp. Name it anything you like.

2. Create a new text layer and name it "dummy" (this layer can be turned off; it feeds a number to the final text layer. I haven't found a way around this; please let me know if there's another way).

3. Add a slider to the "dummy" layer (Effects > Expression Controls > Slider Control). After Effects should automatically name the slider control "Slider"

4. Add an expression to Source Text of "dummy" (Animation > Add Expression).

5. Pickwhip the expression to the "Slider" control from step 3.

6. Create a second text layer. This will be the layer that displays the formatted number.

7. Add an expression to Source Text of the new text layer. Replace the code with the following:

var num = thisComp.layer("dummy").text.sourceText;

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;

}

Now try changing the value of the "Slider" control. Your visible text layer should reflect that number, now formatted with commas. Two catches: it only works for integers, and the slider tops out at 1,000,000. You should be able to pickwhip to any propery that contains a number (decimals are rounded off automatically).

Thanks A LOT! This was very helpful! I wish I could understand what was going on so I wouldn't have to come back here every time. Got lost at number.length % 3.

I tickle pixels!

http://IdeastoCreations.blogspot.com

http://IdeastoCreations.blogspot.com

- davdalx
**Posts:**72**Joined:**11/3/2010, 6:35 am**Location:**Nairobi, Kenya**Twitter:**davdalx

### Re: Counting to 100.000.000

you can also use vdodna's Counter Preset, to save all the time of coding and head bashing :

http://www.vdodna.com/products/counter-preset/

http://www.vdodna.com/products/counter-preset/

- lrntbb2
**Posts:**4**Joined:**06/3/2016, 2:58 am**System Specs:**i7

32 gigs

gtx 770

### Re: Counting to 100.000.000

Just to modify the code above to not use a dummy layer...

1. Create text layer.

2. Add a slider control

3. paste this into source text.

var num = effect("Slider Control")("Slider")*1000 // *1000 this makes the slider be able to go beyond 1,000,000, up to 1,000,000,000

num = Comma(num);

[num] // Altering this to say something like ["$"+num] or [num+"%"] to add a dollar sign or percent to the number.

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;

}

// Your welcome. ha ha @tyrone_perry

1. Create text layer.

2. Add a slider control

3. paste this into source text.

var num = effect("Slider Control")("Slider")*1000 // *1000 this makes the slider be able to go beyond 1,000,000, up to 1,000,000,000

num = Comma(num);

[num] // Altering this to say something like ["$"+num] or [num+"%"] to add a dollar sign or percent to the number.

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;

}

// Your welcome. ha ha @tyrone_perry

- tyrone_perry
**Posts:**1**Joined:**10/24/2017, 8:47 pm**System Specs:**Um My computer has a gtx 1080, and uh... some seaslugs... I think.

### Re: Counting to 100.000.000

this is great!

Is there a way so that the tracking distance between the numbers doesn't fluctuate?

Is there a way so that the tracking distance between the numbers doesn't fluctuate?

- martycg
**Posts:**11**Joined:**09/20/2017, 11:29 am**System Specs:**iMac 2015

4GHz

32 GB ram

8 posts • Page

**1**of**1**