Creative Communities of the World Forums

The peer to peer support community for media production professionals.

Forums Adobe After Effects Expressions Text layers to maintain distance from each other

  • Text layers to maintain distance from each other

  • Iustin Filip-Mucenic

    April 29, 2021 at 9:28 am

    Hi all,

    I am hoping someone can figure this out for me. I have a bunch of text layers (about 20) that are all set in a line. I would like to figure out a way for them to maintain the same distance from each other even when the source text gets changed. (i have them all parented to a “control” text layer as a template). At the moment if I change the text inside they of course maintain position. I need them to be separate to be able to animate them individually which is why i can’t just have one long text layer. Thanks in advance.

  • Filip Vandueren

    April 29, 2021 at 12:25 pm

    The easiest is if you make a parent-chain, always parent the next layer to the one that should be to its left.

    Then you can give position this expression:

    sr=parent.sourceRectAtTime(time);
    [sr.left+sr.width,0]+value;

    Start by setting the position to 0,0 and then you can tweak to get the word-spacing right

  • Trent Armstrong

    April 29, 2021 at 1:17 pm

    I stand fully by the solution Filip has provided, and I will offer a secondary solution. This project has each layer referencing the position and size of the previous layer through expressions. I don’t consider it better or worse. It is just another way of accomplishing your goal. That’s what I enjoy so much about After Effects! There are—many times—multiple ways to achieve a result.

  • Filip Vandueren

    April 30, 2021 at 12:15 pm

    Here’s a third solution ;-), based on Trent’s, but also obeying the scaling of the previous layer (you mentioned you waneted to animate them, so maybe you want to scale them up and down too and have the other text-layers react):

    s = thisComp.layer("TEXT 1").effect("Padding")("Slider");
    prev = thisComp.layer(index - 1);

    w = prev.sourceRectAtTime().width;

    prev.toComp([w + s, 0]);

    (This assumes all text-layers are standard Left Aligned Text though)

Viewing 1 - 4 of 4 posts

Log in to reply.

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