Skip to main content
Participating Frequently
November 5, 2014
Question

Creating a number counter that counts in increments of .05 in After Effects.

  • November 5, 2014
  • 1 reply
  • 4034 views

I need to create a number counter that counts in increments of .05 in After Effects.  Any advice on how to do this?

Many thanks!

This topic has been closed for replies.

1 reply

Tim Kurkoski
Adobe Employee
Adobe Employee
November 5, 2014

This is relatively easy to do with an expression on a text layer's Source Text property. Use the existing timeToFrames() method and divide by 2:


timeToFrames(t = time + thisComp.displayStartTime, fps = 1.0 / thisComp.frameDuration, isDuration = false)/2;

But if you don't want it to trim the decimal place off of integer values, use the toFixed() method.

halfFrames = (timeToFrames(t = time + thisComp.displayStartTime, fps = 1.0 / thisComp.frameDuration, isDuration = false))/2;

halfFrames.toFixed(1);

Just for kicks, I expanded a version that pads leading zeros for up to three pre-decimal digits:

halfFrames = (timeToFrames(t = time + thisComp.displayStartTime, fps = 1.0 / thisComp.frameDuration, isDuration = false))/2;

if (halfFrames >= 10 && halfFrames < 100) {

halfFrames = "0" + halfFrames.toFixed(1);

}

else if (halfFrames >= 0 && halfFrames < 10) {

halfFrames = "00" + halfFrames.toFixed(1);

}

else {

halfFrames.toFixed(1);

}

sylvviaAuthor
Participating Frequently
November 6, 2014

thanks so much for the response.  I actually need to do a counter that goes from 0.00 to 1.30  in .05 increments.  So it would go: 0.00, 0.05, 0.10, 0.15   and so on up to 1.30.  Your above expressions count in .5 increments... I can't get my head around what I need to change to make it work..   any input would be appreciated

thanks!

sylvviaAuthor
Participating Frequently
November 9, 2014

sylvvia wrote:

I may just end up motion stabilizing the decimal point if I can't figure anything else out.

That sounds like an unnecessarily complicated method. I recommend padding the leading digits. That should keep the length of the text stable. (See my last post for more detail.)


thanks you guys!  I got it to work by placing-

timeToFrames(t = time + thisComp.displayStartTime, fps = 1.0 / thisComp.frameDuration, isDuration = false) / 20;

into the "value/offset/random" property of the numbers effect.

all the best

Sylvia