ADOBE AFTER EFFECTS: Forum Expressions Tutorials Creative Cloud

Re: Counter to billions with slider control

COW Forums : Adobe After Effects Expressions

FAQ   •   VIEW ALL   •   ADD A NEW POST   •   PRINT
Respond to this post   •   Return to posts index   •   Read entire thread


Chris Wright
Re: Counter to billions with slider control
on Nov 8, 2010 at 6:13:40 am

102 billion is a big number so I don't think anyone will notice if you do slider*10 or something. Another way is use a counting code.

have a source text, add timewarp whole frames to and then pickwhip its speed to slider. the text will count as fast as the length of the layer, then the timewarp whole frames will be keyframed.


the text box source would be
//
numDecimals = 0;
commas = true;
dollarSign = false;
beginCount = 0;
endCount = 102456367670;
dur = Math.floor(thisLayer.outPoint-thisLayer.inPoint);

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;
}

http://technicolorsoftware.hostzi.com/


Posts IndexRead Thread 


Current Message Thread:





© 2020 CreativeCOW.net All Rights Reserved
[TOP]