Exit
  • Global community
    • Language:
      • Deutsch
      • English
      • Español
      • Français
      • Português
  • 日本語コミュニティ
  • 한국 커뮤니티
2

After Effects Number Generator

New Here ,
Jul 23, 2018 Jul 23, 2018

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!

4.7K
Translate
Report
Community guidelines
Be kind and respectful, give credit to the original source of content, and search for duplicates before posting. Learn more
community guidelines

correct answers 1 Correct answer

Valorous Hero , Jul 23, 2018 Jul 23, 2018

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 -

...
Translate
LEGEND ,
Jul 23, 2018 Jul 23, 2018

"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.

Translate
Report
Community guidelines
Be kind and respectful, give credit to the original source of content, and search for duplicates before posting. Learn more
community guidelines
Community Expert ,
Jul 23, 2018 Jul 23, 2018

Goole Dan Eberts universal timer. That's where you should start.

Translate
Report
Community guidelines
Be kind and respectful, give credit to the original source of content, and search for duplicates before posting. Learn more
community guidelines
Valorous Hero ,
Jul 23, 2018 Jul 23, 2018

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

Very Advanced After Effects Training | Adaptive & Responsive Toolkits | Intelligent Design Assets (IDAs) | MoGraph Design System DEV
Translate
Report
Community guidelines
Be kind and respectful, give credit to the original source of content, and search for duplicates before posting. Learn more
community guidelines
New Here ,
Jul 24, 2018 Jul 24, 2018
LATEST

Thanks! The video link helped a lot!

Translate
Report
Community guidelines
Be kind and respectful, give credit to the original source of content, and search for duplicates before posting. Learn more
community guidelines