Activity › Forums › Adobe After Effects › Why doesn’t the AE Numbers plug-in have commas???
-
Why doesn’t the AE Numbers plug-in have commas???
Posted by Nick Natteau on February 17, 2012 at 8:51 pmJust wondering why the Numbers plugin has no option for commas.
Why is it that using the Numbers decimal counter plugin you can display “1080.90” but there’s no option to display that same number as “1,080.90”
Am I missing something or does the Numbers plug-in in After Effect have no comma option for numbers above 999???
And if that’s the case, supposing i wanted a decimal counter to display numbers with commas as well as dots, how can I get the commas to display so that for example 123456.10 reads “123,456.10”
Thanks very much in advance if someone can point me to a simple tutorial or decimal counter expression script that generates a decimal counter with commas and dots for four figure numbers.
Declan Smith replied 10 years ago 8 Members · 27 Replies -
27 Replies
-
Declan Smith
February 17, 2012 at 9:42 pmNick
I will put this in a code section as I think the COW has been stripping bits off, but the basic answer to your question is that javascript is lacking in number format area and you have to write your own function for it. I have got your expression down to a one liner for you. If you want to do the same format to another number, first make sure your number is a string, then add from the .replace part as below: I have cut & pasted and tested this so it should work for you
(effect("Slider Control")("Slider").value.toFixed(0)+" Miles").replace(/(d)(?=(d{3})+(?!d))/g, "$1,");
Declan Smith
https://www.madpanic.tv
FCS3 / After Effects CS5 / Combustion / Canon 7D / Canon XL2 -
Declan Smith
February 17, 2012 at 9:55 pm
(effect("Slider Control")("Slider").value.toFixed(0)+" Miles").replace(/(\d)(?=(\d{3})+(?!\d))/g, "$1,");Last attempt above to get the cow to insert backslashes. Everytime you see a d above put a backslash before it if backslashes are not being displayed.
It should look like this:
Declan Smith
https://www.madpanic.tv
After Effects CS5.5/ FCS3 / Canon 7D / Canon XL2 / Reason / Cubase -
Nick Natteau
February 17, 2012 at 11:02 pmHi Declan,
Thank you so much! I really appreciate your help.
-
Nick Natteau
February 17, 2012 at 11:05 pmHi Decan,
One more question. If this number were a currency instead of a distance and i wanted the “$” symbol before instead of after the number, where in the expression would the “$” symbol have to go to be before rather than after the number?
Thanks again so much for helping me out with this.
-
Declan Smith
February 18, 2012 at 12:18 amHi
You would put the currency symbol before the expression. I have shown this below, and shown it more verbosely in the second example.
"$" + (effect("Slider Control")("Slider").value.toFixed(0)).replace(/(\d)(?=(\d{3})+(?!\d))/g, "$1,");
In the fragment below, number is a variable that takes the numeric value from the slider. The other variable names should be self explanatory and are all strings.
The last line shows how they are concatenated together.
number = effect("Slider Control")("Slider").value;
numberFormatted = number.toFixed(0);
numberFormattedAsStringWithCommas = (numberFormatted + '').replace(/(\d)(?=(\d{3})+(?!\d))/g, "$1,");
prefix="$";prefix + numberFormattedAsStringWithCommas;
Declan Smith
https://www.madpanic.tv
After Effects CS5.5/ FCS3 / Canon 7D / Canon XL2 / Reason / Cubase -
Nick Natteau
February 20, 2012 at 5:20 pmHi Declan,
If I might just ask you another follow up question regarding the numbers effect.
I’m doing this for a documentary film about Hyperinflation in Weimar Germany when the Reichmark went from 12 Rm to the dollar to 4,200,000,000,000 Rm.
So my problem now is that in AE the number seems to stop at 1,000,000. How do I get past this??? I’m sure there’s a way but i can’t figure out. Thank you very much in advance.
-
Declan Smith
February 20, 2012 at 6:00 pmI think that is a hard limit of the slider control. Not quite sure what you are doing, but I guess you are keyframing the value or something. You could use a “Point Control” instead of a slider and just use one of the dimensions if you are trying to store the numbeer e.g
replace
effect(“Slider Control”)(“Slider”)
with
effect(“Point Control”)(“Point”)[0]
The full expression would then become:
"$" + (effect("Point Control")("Point")[0].value.toFixed(0)).replace(/(\d)(?=(\d{3})+(?!\d))/g, "$1,");
Declan Smith
https://www.madpanic.tv
After Effects CS5.5/ FCS3 / Canon 7D / Canon XL2 / Reason / Cubase -
Nick Natteau
February 20, 2012 at 8:13 pmHi Declan,
Sorry but I can’t get it to work. I just copy and pasted your last line exactly as you had it and now nothing appears:
“$” + (effect(“Point Control”)(“Point”)[0].value.toFixed(0)).replace(/(d)(?=(d{3})+(?!d))/g, “$1,”);
-
Declan Smith
February 20, 2012 at 8:38 pmNick,
Sorry, would have help if I had pasted a valid expression 😉
Try this. I have also included the screen shot in case the characters get corrupted:
"$" + (effect("Point Control")("Point")[0].toFixed(0)).replace(/(\d)(?=(\d{3})+(?!\d))/g, "$1,");
Declan Smith
https://www.madpanic.tv
After Effects CS5.5/ FCS3 / Canon 7D / Canon XL2 / Reason / Cubase -
Nick Natteau
February 20, 2012 at 9:05 pmHi Declan,
Sorry to keep bothering you like this. But my final question: how would I ramp up my numbers in speed.
For example in my animation I have to show the Reichsmark hyperinflation increasing from
$1=12 Rm in 1919 to $1=17,000 Rm by 1923…But in 1923 it increases dramatically from $1=17,000 Rm in Jan 1923 to $1=4,200,000,000 by Dec 1923
So I would need my numbers to ramp up in speed dramatically. Does this require another expression???
Reply to this Discussion! Login or Sign Up

