Quantcast
Channel: Adobe Community : Popular Discussions - After Effects Expressions
Viewing all articles
Browse latest Browse all 47983

Animate Number Counter - French Version

$
0
0

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?


Viewing all articles
Browse latest Browse all 47983

Trending Articles



<script src="https://jsc.adskeeper.com/r/s/rssing.com.1596347.js" async> </script>