Creative Communities of the World Forums

The peer to peer support community for media production professionals.

Forums Adobe After Effects Expressions Maintain Gap Between Text Layers, No Matter The Width Of Text

  • Maintain Gap Between Text Layers, No Matter The Width Of Text

  • Andrew Ross

    January 14, 2022 at 5:25 pm

    Hi guys

    I have a comp with 5 text layers on the X axis.


    I would like these text layers to be positioned 200px apart from each other.


    I’m going to be duplicating this composition numerous times and altering the text using “thisComp.name” but I would like the distance between the layers to remain at 200px no matter how long the word happens to be, whether it’s 3 letters or 20.


    These text layers will be animating along the x-axis from left to right (I’m not sure If this has any bearing on the expression).


    I’ve done some searching on the forums and have found a few expressions that I thought would do the trick, but they always seem to end up with the text overlapping and not keeping the distance between the layers.


    <font face=”inherit”>My knowledge of expressions isn’t that adept to be able to edit them so that’s where I’m probably falling with this one as I imagine it’s a simple task, so apologies if I’m posting something that has already been posted but like </font>I<font face=”inherit”> say, </font>I<font face=”inherit”> can’t get some of the expressions on here to work. </font>


    Thanks in advance
    Andrew

  • Kevin Camp

    January 14, 2022 at 7:21 pm

    Something like this should work, add it to the position property and set the ‘target’ to be the layer that you want it to maintain 200px from.

    target = thisComp.layer("LayerToFollow") ;
    rect = target.sourceRectAtTime() ;
    x = target.position[0] + rect.left + rect.width + 200 ;
    [ x, value[1] ]

    The expression assumes that the text layers are left-justified and none are parented.

    If you animate the furthest left text layer, the text layers with that expression will follow it along the x-axis.

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