ADOBE AFTER EFFECTS: Forum Expressions Tutorials Creative Cloud

Number Increasing Automatically

COW Forums : Adobe After Effects

<< PREVIOUS   •   FAQ   •   VIEW ALL   •   PRINT   •   NEXT >>
Marcio Souza
Number Increasing Automatically
on Oct 14, 2013 at 4:07:33 am

I have seen some posts here but none of them has the answer I am looking for.
I want to make a number increasing from 0 to 28 357 561, if possible with $ at the beginning. I have seen some tutorials on youtube but all of them just teach you how to increase the number up to 1000000, if it is possible I want to keep the spaces every 3 numbers.

Thanks


Return to posts index

John Cuevas
Re: Number Increasing Automatically
on Oct 14, 2013 at 1:56:03 pm

Create a text layer(shift+cntl+alt+T) and make it right justified. Add the effect Expressions Control > Angle Control to the effect.

Twirl open the text layer and alt click the source text stopwatch to open the expression dialogue and add the following expression(courtesy of Dan Ebberts). I used comma's instead of spaces, but if you want spaces in the line "outStr += "," + s.substr(-i*3,3)" replace the comma in quotes with space: numDecimals = 2;
commas = true;
dollarSign = true;
dur = 4;
s = effect("Angle Control")("Angle").value.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;
}


I made an example project if anything is unclear: 6633_moneycounter.aep.zip

Johnny Cuevas, Editor
Thinkck.com

"I have not failed 700 times. I have succeeded in proving that those 700 ways will not work. When I have eliminated the ways that will not work, I will find the way that will work."
---THOMAS EDISON on inventing the light bulb.


Return to posts index

Marcio Souza
Re: Number Increasing Automatically
on Oct 15, 2013 at 3:30:01 am

Hey John,

Thanks a lot, that is exactly what I was looking for and I could not find anywhere.
You are the best!


Return to posts index


John Cuevas
Re: Number Increasing Automatically
on Oct 16, 2013 at 12:29:18 am

It was mostly Dan Ebberts who did, but I'm glad I was able to pass it on.

Johnny Cuevas, Editor
Thinkck.com

"I have not failed 700 times. I have succeeded in proving that those 700 ways will not work. When I have eliminated the ways that will not work, I will find the way that will work."
---THOMAS EDISON on inventing the light bulb.


Return to posts index

<< PREVIOUS   •   VIEW ALL   •   PRINT   •   NEXT >>
© 2017 CreativeCOW.net All Rights Reserved
[TOP]