ADOBE AFTER EFFECTS: Forum Expressions Tutorials Creative Cloud

After Effect Numbers add Dollar sign

COW Forums : Adobe After Effects

<< PREVIOUS   •   FAQ   •   VIEW ALL   •   PRINT   •   NEXT >>
Matt Van Dyck
After Effect Numbers add Dollar sign
on Jul 3, 2014 at 3:09:38 pm

Hello.

Is it possible with the after effects effect 'text > numbers' to add a dollar sign to the number counter?

Thanks for any help!


Return to posts index

John Cuevas
Re: After Effect Numbers add Dollar sign
on Jul 4, 2014 at 12:27:53 pm

Not with the number effect. The best way is to use an expression. Create a text layer (Cntl+Alt+Shift+T) and add a Effect>Expression Control>Slider Control to it. Twirl open your text layer, and twirl open "Source Text" and add this expression(courtesy Dan Ebberts).

numDecimals = 2;
commas = true;
dollarSign = true;
dur = 4;
s = effect("Slider Control")("Slider").value.toFixed(numDecimals);

prefix = "";
if (s[0] == "-"){
prefix = "-";
s = s.substr(1);
}
if(dollarSign) prefix += "$";

if (commas){
decimals = "";
if (numDecimals > 0){
decimals = s.substr(-(numDecimals + 1));
s = s.substr(0,s.length - (numDecimals + 1));
}
outStr = s.substr(-s.length, (s.length-1)%3 +1);
for (i = Math.floor((s.length-1)/3); i > 0; i--){
outStr += "," + s.substr(-i*3,3);
}
prefix + outStr + decimals;
}else{
prefix + s;
}


Right justify your text layer and keyframe the slider control and you are done.

Here's an example project if you have any questions. 7713_counter.aep.zip

Johnny Cuevas, Editor
Thinkck.com

"I have not failed 700 times. I have succeeded in proving that those 700 ways will not work. When I have eliminated the ways that will not work, I will find the way that will work."
---THOMAS EDISON on inventing the light bulb.


Return to posts index

<< PREVIOUS   •   VIEW ALL   •   PRINT   •   NEXT >>
© 2017 CreativeCOW.net All Rights Reserved
[TOP]