Creative Communities of the World Forums

The peer to peer support community for media production professionals.

Forums Adobe After Effects Expressions How to group two text layers next to each other using expressions?

  • How to group two text layers next to each other using expressions?

  • Maeve Tan

    October 8, 2021 at 12:53 pm

    Hi guys,
    I’m trying to figure out how to place two text layers next to each other using expressions in AE.
    I want to place them next to each other and have them stay next to each other, but if the text in front of the second text changes, the second text should adjust itself, staying next to the front text.

    For example: Text Layer 1 displays: Marco Text Layer 2 displays: Polo
    So they would be next to each other like Marco Polo
    But if I change Marco to Sam, the first text is shorter, so the second text will have to move a bit to the left and be shown as Sam Polo instead of Sam_____Polo. Or if I change the first text layer to a longer name, like Nathaniel, the second text should move more to the right so that it will look like Nathaniel Polo and not that the first text layer will go over or squish the second layer.
    I hope this makes sense and that you understand what I mean. I want to use expressions/coding to do this.
    Thanks beforehand!

  • Andrei Popa

    October 9, 2021 at 6:07 am

    Are your texts always gonna be on same line?

    If ever the words are too long and they have to descend to the next line, things get a lor more complicated. I imagine the simplest case would be 2 words, left justified texts. Second word should have this attached to the position. They should also be consecutive in the timeline, meaning the first word should be the layer above the second word.


    L = thisComp.layer(index - 1);

    R = L.sourceRectAtTime(0, false);

    W = R.width;

    diff = 20;

    L.position + [W + diff, 0];

Viewing 1 - 2 of 2 posts

Log in to reply.

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