Creative Communities of the World Forums

The peer to peer support community for media production professionals.

Activity Forums Adobe After Effects Expressions Counter – no moving text + no monospace

  • Counter – no moving text + no monospace

    Posted by Yoan Boisjoli on April 12, 2023 at 2:21 am

    I’m creating a MOGRT in which I would like the user to input text containing numbers. The goal is to automatically detect and animate these numbers. I’ve managed to accomplish this, but as you might expect, the text moves around. To address this, I’ve split the text layer into two separate layers: one containing everything before the number, and the second containing the number and everything after it. I’ve linked them, and everything works fine.

    However, I’ve encountered a couple of issues. First, if the user wants to include more than one number, the current setup won’t work. Second, if the user inserts a line break, it breaks the expressions.

    My question is: has anyone figured out a way to animate numbers within a text layer without the surrounding text moving?

    As a potential solution, I’m considering using two text layers: one where the numbers are invisible, and the other where the text is invisible. I’m hoping to combine both layers and achieve the desired result.

    If you’re curious, I’ve attached a screenshot that shows the code used to detect and count any numbers within the text.

    Yoan Boisjoli replied 1 year, 7 months ago 2 Members · 5 Replies
  • 5 Replies
  • Yoan Boisjoli

    April 12, 2023 at 2:21 pm

    I discovered a solution involving two layers. The first layer conceals numbers, while the second layer displays every alternate character. These layers are then combined. The second layer uses an expression to sample the source text at the 3-second mark once the animation is complete.

  • Filip Vandueren

    April 13, 2023 at 7:38 am

    You can use a text animator that transforms the numbers with unicode character offsets instead of changing the sourceText, unless you explicitly choose the “adjust kerning” option, the following text will not move.

  • Yoan Boisjoli

    April 26, 2023 at 10:44 am

    Sounds like a good idea. I’ll have to make some tests. I’m curious to see how to implement your idea.

    It would be great to find a solution. In my work around mentioned above, I ended up adding a padding to the numbers so if there is more than one number, the final spacing is already there for the words around the number.


    I’ll share my Ae file if you want.

  • Filip Vandueren

    May 2, 2023 at 6:52 am

    Let me know if you run into any issues…

  • Yoan Boisjoli

    May 4, 2023 at 7:29 pm

    So far my template runs well.
    Of course I would have wish for doing everything on one layer but 2 layers works for me here.

    But in a nutshell this is what I did:

    1. Created two layers: one for text and one for numbers.
    2. Used an expression selector to hide numbers on the text layer and everything except numbers on the number layer.
    3. Set up a main text layer to detect and animate numbers to count up.
    4. Set the text layer to be equal to the main layer at the 3 second mark using valueAtTime(3), so the animation is complete and the text doesn’t move around when the numbers are animated.
    5. Added a feature to ignore numbers within a certain character.

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