I need help figuring out how to animate a number counter, but in french. I have the english version of my numbers animating up using the following algorithm:
numDecimals = 1;
commas = true;
dollarSign = true;
beginCount = 0;
endCount = 20.3;
dur = 2.5;
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 < 1){
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);
}
outStr + decimals + prefix;
}else{
prefix + s;
}
Right now the number counts from 0 to 20.3%, with a decimal inbetween 20 and 3. The french version I need to make is "20,3 %". Does anyone know how to manipulate this algorithm so it fits the french version - with the comma instead of the decimal?