Creative Communities of the World Forums

The peer to peer support community for media production professionals.

Activity › Forums › Adobe After Effects › After Effect Numbers add Dollar sign

  • John Cuevas

    July 4, 2014 at 12:27 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.

We use anonymous cookies to give you the best experience we can.
Our Privacy policy | GDPR Policy