AE数值递增常见处理方法

AE Numbers

(请切换到超清模式或者下载观看)

AE数值递增常见处理方法

做数字数值递增的时候,添加Numbers特效是最常用的方法,但是数值最大只能达到3W,于是我们可以用Slider Control来控制数值地址,但是也只能达到100W……凌晨4、5点失眠起来鼓捣的教程,可能有的地方不是很清楚,大家相互交流……

提到的知识点包括:

  1. 超过3W数值递增方法
  2. 超过100W数值递增方法
  3. 隔3位数添加逗号的计数方法
  4. linear(time,0,1,value1,value2),Math.round()和.toFixed()的运用

添加逗号所用到的表达式,如果想用下面提供的表达式,空物体Null的名称必须为“Controls”,三个控制器名称分别为“number”“amt_of_decimals”“use_commas”,分别控制数值,小数点后的位数,是否需要逗号。

从国外找到的表达式(如果表达式复制出问题,请到新浪博客上面复制:http://blog.sina.com.cn/s/blog_6d7c8f4b0101ir3y.html):

num = thisComp.layer(“Controls”).effect(“number”)(“Slider”);

amtOfDec = thisComp.layer(“Controls”).effect(“amt_of_decimals”)(“Slider”);

commas = thisComp.layer(“Controls”).effect(“use_commas”)(“Checkbox”);

num = num + 0;

amtOfDec = amtOfDec + 0;

commas = commas == 1;

if(! commas){

num.toFixed( amtOfDec );

}else{

function addCommas( str ){

finalResult = “”;

for( i = str.length – 1; i >= 0; i– ){

finalResult = str.charAt( i ) + finalResult;

if( (str.length – i) % 3 == 0  && i != 0 )

finalResult = “,” + finalResult;

}

return finalResult;

}

intPart = Math.floor( Math.abs( num ) );

decPart = Math.abs(num) – intPart;

wasNeg = num < 0;

result = “”;

if( wasNeg )

result = “-” + result;

intPartString = intPart + “”;

decPartString = decPart.toFixed( amtOfDec ) + “”;

decPartString = decPartString.substring( 1 );

result = result + addCommas( intPartString ) + decPartString;

result

}

BaiDu

4 Responses

  1. aiax说道:

    学到了

  2. MGO说道:

    谢谢站长~~~

  3. 听M小姐说说道:

    请问破3w的教程是用到了插件吗?

  4. F慁澤说道:

    请问带逗号的超过100w的怎么做?

发表回复