新浪博客

AE数值递增常见处理方法

2014-06-20 12:48阅读:17
AE数值递增常见处理方法X


(请切换到超清模式或者下载观看)
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”,分别控制数值,小数点后的位数,是否需要逗号。
从国外找到的表达式:
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
}
百度网盘下载地址:
AE数值递增常见处理方法
龋齿一号淘宝店:http://gfxcamp.taobao.com
龋齿一号新浪博客:http://blog.sina.com.cn/u/1836879691
龋齿一号GFXCamp新浪微博:http://weibo.com/gfxcamp
GFXCamp文章,转载请注明并附上原文链接!CG交流群:347746763(验证GFXCamp或者龋齿一号)

我的更多文章

下载客户端阅读体验更佳

APP专享