Creative Communities of the World Forums

The peer to peer support community for media production professionals.

Activity Forums Adobe After Effects Expressions maintaining distance dynamically

  • maintaining distance dynamically

    Posted by Steve Mintz on June 2, 2020 at 1:40 am

    Hello.

    I have a bracket that is a shape layer.
    I have text in the middle, that will be changing as it is data driven.
    I want the gap between the text and the line to be dynamic and maintain the same distance along the x-axis. The bracket point on the end has a node attached to it.
    This idea will repeat for the right side as well as there will also be a bracket.

    How do I do this?

    Andrei Popa replied 6 years, 3 months ago 2 Members · 1 Reply
  • 1 Reply
  • Andrei Popa

    June 2, 2020 at 8:14 am

    If your text is center justified, this expression to position should work.

    Left bracket
    textLayer = thisComp.layer(index+1);
    textRect = textLayer.sourceRectAtTime(time,false);
    textPos = textLayer.position;
    diff = 20;
    [textPos[0]-textRect.width/2-diff,value[1]]

    Right bracket
    textLayer = thisComp.layer(index+1);
    textRect = textLayer.sourceRectAtTime(time,false);
    textPos = textLayer.position;
    diff = 20;
    [textPos[0]+textRect.width/2+diff,value[1]]

    On the first row you must link your text layer. Select the ” thisComp.layer(index+1)” part and pick-whip your text layer.
    You can modify diff to increase/decrease the distance between the bracket and the text.

    Andrei
    My Envato portfolio.

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