AE ENHANCERS

Expressions/Scripts/Presets
It is currently Thu May 23, 2013 2:16 am

All times are UTC - 8 hours [ DST ]




Post new topic Reply to topic  [ 3 posts ] 
Author Message
 Post subject: Count up
PostPosted: Wed Mar 24, 2010 3:49 pm 
Offline

Joined: Tue Mar 23, 2010 2:48 pm
Posts: 2
I created a script with a text object and a null object that does a simple count for a duration that I define with the null object.

Math.floor(thisComp.layer("Null 1").effect("Slider Control")("Slider"));

If I make the slider go to, let's say 10000 for example, is there a way to have the counter produce 0's before the number? Also, what about comma's?

Illustration:

Current-
0, 1, 2....125...250..999...1000...5000...9999....10000
(these are just random numbers but it technically produces every number 0 to 10000)

What I'd like to achieve to achieve is the following:
00000, 00001, 00002....00125....00250....00999....01,000....05,000....09,999...10,000


Top
 Profile  
 
 Post subject: Re: Count up
PostPosted: Wed Mar 24, 2010 4:18 pm 
Offline

Joined: Sat Jun 26, 2004 10:01 am
Posts: 298
Location: Folsom, CA
Try this:

Code:
n = Math.floor(thisComp.layer("Null 1").effect("Slider Control")("Slider"));
s = "" + n;
len = s.length;
if (len > 3) s = s.substr(0,len-3) + "," + s.substr(-3);
for (i = 1; i <= 5 - len; i++) s = "0" + s;

Dan

_________________
http://www.motionscript.com


Top
 Profile  
 
 Post subject: Re: Count up
PostPosted: Thu Mar 25, 2010 10:14 am 
Offline

Joined: Tue Mar 23, 2010 2:48 pm
Posts: 2
Worked like a charm!

Thanks Dan!


Top
 Profile  
 
Display posts from previous:  Sort by  
Post new topic Reply to topic  [ 3 posts ] 

All times are UTC - 8 hours [ DST ]


Who is online

Users browsing this forum: No registered users and 1 guest


You cannot post new topics in this forum
You cannot reply to topics in this forum
You cannot edit your posts in this forum
You cannot delete your posts in this forum
You cannot post attachments in this forum

Search for:
Jump to:  
Powered by phpBB © 2000, 2002, 2005, 2007 phpBB Group