-
Counter counting upto 100,000,000 – Syntax Error
I am trying to create a counter that starts at 10,000 and goes upto maybe 100,000,000.
I found this tutorial which would allow me to do that but when I paste this code in AFX it gives me a syntax error.
https://trelhouse.com/article/41/after-effects-tutorial-number-count-over-30000Would any of you know why its doing this or if theres another solutions?
Oh…and I need to use commas as well.
Any help is much appreciated.
Thx1. Create a Text Layer
2. Select Effects > Expression Controls > Slider Control
3. Name the Slider “value”
4. Select Effects > Expression Controls > Slider Control
5. Name that slider “multiplier”
6. Alt-Click on the SourceText and paste this into the expressions fields = effect(“value”)(“Slider”);
m = effect(“multiplier”)(“Slider”); //use for numbers greater than 1 million
v = s*m; //value of counterfunction digits(Val, Digits)
{var n = Val.toString(); while (n.length < Digits) n = ‘0’ + n; return n;} h = Math.floor(v); t = Math.floor(h / 1000); m = Math.floor(t / 1000); b = Math.floor(m / 1000); hd = digits(h-t * 1000, 3); td = digits(t-m * 1000, 3); md = digits(m-b * 1000, 3); if (v < 1000) {h} else if (v < 1000000) {t + “,” + hd} else if (v < 1000000000) {m + “,” + td + “,” + hd} else {b + “,” + md + “,” + td + “,” + hd}