Creative Communities of the World Forums

The peer to peer support community for media production professionals.

Activity Forums Adobe After Effects Expressions Ramping the numbers expression

  • Ramping the numbers expression

    Posted by Will Eccleston on August 27, 2012 at 7:15 pm

    Is there a way to very smoothly ramp into a number counter expression? Start counting slowly and ramp up over time? I’m using an expression that I think is Dan’s originally, (not sure). Any help very much appreciated and sorry if this has been covered, I swear I searched. I want to take a couple or three seconds to get into the mid-hundred-thousands and then increase the pace so that by 5 or 6 seconds I’m in the trillions. Here’s what I’m using, no ramp:

    numDecimals = 0;
    commas = true;
    dollarSign = true;
    beginCount = 00;
    endCount = 222222187652003;
    dur = 35;
    t = time – inPoint;
    s = linear (t, 0, dur, beginCount, endCount).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;
    }

    Will Eccleston
    Kinetiscape Films

    Will Eccleston replied 13 years, 8 months ago 2 Members · 2 Replies
  • 2 Replies
  • Dan Ebberts

    August 27, 2012 at 8:44 pm

    Try replacing the line that defines variable s with this:

    s = linear (t*t*t, 0, dur*dur*dur, beginCount, endCount).toFixed(numDecimals);

    Dan

  • Will Eccleston

    August 28, 2012 at 3:05 pm

    Seems to have worked. Thank you! I wish I could download your understanding of this stuff. I can learn programming languages, and have before, but just being able to comprehend the operations that need to take place to achieve the goal, that’s something else entirely.

    Will Eccleston
    Kinetiscape Films

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