-
Number Count Up Expression
I’m using an expression to have a dollar amount of text count up from $0 up to $175
I do not need a decimal or change so I have taken that out. I do need a dollar sign.
My question is…
How can you tell the expression to use superscript for the dollar sign? While on the same topic, how would you tell the expression to use superscript for the change if you were to use a decimal?numDecimals = 0;
commas = true;
dollarSign = true;
beginCount = 0;
endCount = 175;
dur = .8;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;
}