Creative Communities of the World Forums

The peer to peer support community for media production professionals.

Activity Forums Adobe After Effects Expressions Trying to find a better way to make a counter.

  • Trying to find a better way to make a counter.

    Posted by Adam Cohen on April 29, 2009 at 9:27 pm

    I’m trying to make a counter to go form 5000 down to 0000

    With keys, a slider effect and this script I have a counter that goes from 5000 to 0.

    slider = effect(“Slider Control”)(“Slider”);
    Math.round(slider/1)

    I did a pick whip expression to link a text layer to the slider’s value.

    Can anyone tell me how to convert the numbers with less than 4 digits into a 4 digit number?

    Thanks,
    Adam

    Adam Cohen replied 17 years ago 2 Members · 2 Replies
  • 2 Replies
  • Dan Ebberts

    April 29, 2009 at 10:08 pm

    Try this:

    slider = effect(“Slider Control”)(“Slider”);
    s = “” + Math.round(slider/1);
    while (s.length < 4) s = "0" + s; s Dan

  • Adam Cohen

    April 29, 2009 at 10:21 pm

    Brilliant!

    That’s exactly what I was looking for.

    Thanks so much,
    Adam

We use anonymous cookies to give you the best experience we can.
Our Privacy policy | GDPR Policy