-
Having trouble with a custom Counter expression
Hey Gang,
I’m trying to create / find a number counter expression that does the following:
1. initial number (example: 1540)
2. End number (example: 2323)
3. Having an option to add a comma (example: 2,323)
4. Grow by: # (i.e. the counter will grow by 10)(Instead of counting linearly)(no: 1 2 3 4 5 6) (yes: 10 20 30 40 50)
5. Using time interval (Example: add 10 to initial number every 25 frames)
6. Complete Count in X frames (i.e input how many frames should the counter run from start to finish) (which will determine speed) (I understand it might have some collision with the “Grow by #”)Attaching a script I found in this forum which is really cool but I couldn’t get it to do exactly what I want.
[Basically this script is awesome, is there a way to maybe add Time interval + Grow By #]<– that would solve my problemI’d really appreciate some help here
Thanks!numDecimals = 2;
commas = true;
dollarSign = true;
beginCount = 800;
endCount = 1450;
dur = 120;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;
}