Activity › Forums › Adobe After Effects Expressions › Four digit counter
-
Four digit counter
Posted by Tom De groen on April 28, 2010 at 11:47 amHey yo,
How can I get a counter to always display a total of four digits? Eg: 0001 – 9999 (showing the extra ‘0’s with the lower numbers).
Cheers,
Tom.Tom De groen replied 16 years ago 3 Members · 4 Replies -
4 Replies
-
Dan Ebberts
April 28, 2010 at 2:40 pmAssuming that variable “n” in a source text expression has your value, adding this to your expression should do it:
s = “” + Math.round(clamp(n,0,9999));
while (s.length < 4) s = "0" + s; s Dan -
Hannes Paulsson
April 30, 2010 at 10:43 amYou could use the numbers effect if you want to. Just select “Number [Leading Zeros] in the “type” option.
-
Tom De groen
May 3, 2010 at 6:08 amYeah I tried that but it added 5 ‘0’s when I only wanted 4… is there a simple way to adjust this? I had a look but couldn’t find a solution. Would that involve adding some action script as well?
It’d be good to know as a back pocket fix.
Reply to this Discussion! Login or Sign Up