Copy link to clipboard
Copied
I need a number counter with comas that goes up to at least 100,000,000. Preferably infinitely. The "numbers" effect in AE only goes up to 30,000 (without a coma). This 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;
}
(located here: CreativeCOW ) is limited by the slider which only goes up to 1,000,000, but it does enable comas. Does anyone have a suggestion on how to make this work?
Thanks!
The Expression Point Control effect allows for larger numbers than the Expression Slider Control.
This script will do the trick for you - it includes a $ sign as a prefix.
s = "" + Math.round(effect("Point Control")("Point")[0]);
if (s.length > 3 && s.length < 7)
"$" + s.substr(0, s.length -3) + "," + s.substr(-3)
else if (s.length >= 7 && s.length < 10)
"$" + s.substr(0, s.length -6) + "," + s.substr(-6, 3) +"," + s.substr(-3)
else if (s.length >= 10 && s.length < 13)
"$" + s.substr(0, s.length -
...Copy link to clipboard
Copied
"Infinity" is not a valid concept for software.
Your code starts off by rounding the slider, which throws away the decimals. Multiply first to get your extra digits.
Copy link to clipboard
Copied
Goole Dan Eberts universal timer. That's where you should start.
Copy link to clipboard
Copied
The Expression Point Control effect allows for larger numbers than the Expression Slider Control.
This script will do the trick for you - it includes a $ sign as a prefix.
s = "" + Math.round(effect("Point Control")("Point")[0]);
if (s.length > 3 && s.length < 7)
"$" + s.substr(0, s.length -3) + "," + s.substr(-3)
else if (s.length >= 7 && s.length < 10)
"$" + s.substr(0, s.length -6) + "," + s.substr(-6, 3) +"," + s.substr(-3)
else if (s.length >= 10 && s.length < 13)
"$" + s.substr(0, s.length -9) + "," + s.substr(-9, 3) + "," + s.substr(-6, 3) +"," + s.substr(-3)
else
"$" + s
-----------------------
I got the know-how over here -
Animated number count with commas in After Effects - YouTube
Copy link to clipboard
Copied
Thanks! The video link helped a lot!
Find more inspiration, events, and resources on the new Adobe Community
Explore Now