Creative Communities of the World Forums

The peer to peer support community for media production professionals.

Activity Forums Adobe After Effects Expressions How to make a sliding number counter in After Effects

Tagged: 

  • Dan Ebberts

    May 1, 2024 at 1:33 pm

    What’s a sliding number counter?

  • Mohamed Imran

    May 2, 2024 at 6:41 am

    Hi Dan Ebberts,

    I meant a counter’s number sliding up or down while counting numbers, looks like this pic

  • David Conklin

    May 2, 2024 at 8:30 pm

    There’s not a silver-bullet expression you can apply to a single property to achieve this effect. Depending on how comfortable you are with expressions there are more- and less-complex ways to do it.

    This might get you started:
    1. On a new text layer, type the numbers 0-9 and then another 0, each on its own line.

    0
    1
    2
    ...
    8
    9
    0

    2. Make a new slider on the text layer.

    3. Apply this expression to your text layer’s position:

    const numberSlider = effect("Slider Control")("Slider");
    const leading = text.sourceText.getStyleAt(0,0).leading;
    value - [0, numberSlider * leading];

    A text layer’s leading is how many px tall 1 line is. So 1 * leading = height of 1 line. 5 * leading = height of 5 lines, etc.

    4. Next, apply this expression to your Slider Control:

    value % 10;

    Now, when you animate that slider, it should give you the correct digit up to 10. The expression we added to the slider effector makes the value “wrap” after 10, once it counts up to 9.999999 resets to 0 instead of becoming 1. This is essentially how you’d do you “ones” place. Think about how you might calculate a tens or hundreds place (hint: dividing by a factor of 10 and truncating decimals), that could be a good next step.

    If you combo a couple of these together with some masks and a control layer and you’ve got a rig. There are probably ways to do this with an expression selector on a single text layer, but I don’t think the complexity merits the result.

    Hope that helps get you started.

    Cheers

  • Mohamed Imran

    May 3, 2024 at 2:53 am

    Thank you a lot, it helps to gain knowledge and continue my project.

    excellent!

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