FORUMS: list search recent posts

Ramping the numbers expression

FAQ   •   VIEW ALL
 Ramping the numbers expression on Aug 27, 2012 at 7:15:48 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

 Re: Ramping the numbers expressionon Aug 27, 2012 at 8:44:37 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