ADOBE AFTER EFFECTS: Forum Expressions Tutorials Creative Cloud

Clock counter that starts with '00' instead of just '0'

COW Forums : Adobe After Effects

<< PREVIOUS   •   FAQ   •   VIEW ALL   •   PRINT   •   NEXT >>
joey campbell
Clock counter that starts with '00' instead of just '0'
on Jan 17, 2013 at 11:32:44 am

Hi I've got a standard script that makes my text increase from 0 to 50 over 4 seconds....I'm trying to get it to count like this 00,01,02,03...instead of 1,2,3.....any ideas?

startT = 0;
endT = 4;
beginVal = 0;
endVal = 100;
t = linear(time,startT,endT,beginVal,endVal);
t.toFixed(0)


Return to posts index

Vishesh Arora
Re: Clock counter that starts with '00' instead of just '0'
on Jan 17, 2013 at 12:36:48 pm

joey

Can't say much about the Expression but I have a trick to work around using Numbers Effect.

See the example:
Increase_value_100.zip

If this isn't suitable, You would get an appropriate answer at Adobe After Effects Expressions Forum.

Vishesh Arora
3D and Motion Graphics Artist
Films Rajendra

Blog:
http://digieffects.wordpress.com

2011 3D Demo Reel:








Return to posts index

Declan Smith
Re: Clock counter that starts with '00' instead of just '0'
on Jan 17, 2013 at 12:45:07 pm

Add this to your script; (i'm assuming this is on a text source property)

s=""+t;
while (s.length < 2) s='0'+s;

Declan Smith
http://www.madpanic.tv
After Effects CS5.5/ FCS3 / Canon 7D / Canon XL2 / Reason / Cubase

"it's either binary or it's not"


Return to posts index


joey campbell
Re: Clock counter that starts with '00' instead of just '0'
on Jan 17, 2013 at 2:11:11 pm

Hi Vishesh - I can't open your file as I'm still using CS5 I'm afraid.

Declan - thanks for the help - that change works initially for 00 but after that my counter starts using decimal places so it makes the change void. Is there anyway to get it not to use decimals (so it only goes up in 1's) ?
Joey


Return to posts index

Declan Smith
Re: Clock counter that starts with '00' instead of just '0'
on Jan 17, 2013 at 2:16:19 pm

Yep.
s=""+Math.floor(t);
while (s.length < 2) s='0'+s;

Math.floor(t) will produce the lowest whole integer,
Math.ceil(t) will produce the highest whole integer.

Hope this helps

Declan Smith
http://www.madpanic.tv
After Effects CS5.5/ FCS3 / Canon 7D / Canon XL2 / Reason / Cubase

"it's either binary or it's not"


Return to posts index

joey campbell
Re: Clock counter that starts with '00' instead of just '0'
on Jan 17, 2013 at 2:28:50 pm

Perfect - thanks for your help.


Return to posts index

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