ADOBE AFTER EFFECTS: Forum Expressions Tutorials Creative Cloud

maintaining distance dynamically

COW Forums : Adobe After Effects Expressions

<< PREVIOUS   •   FAQ   •   VIEW ALL   •   PRINT   •   NEXT >>
Steve Mintz
maintaining distance dynamically
on Jun 2, 2020 at 1:40:05 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?


Return to posts index

Andrei Popa
Re: maintaining distance dynamically
on Jun 2, 2020 at 8:14:44 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.


Return to posts index

<< PREVIOUS   •   VIEW ALL   •   PRINT   •   NEXT >>
© 2020 CreativeCOW.net All Rights Reserved
[TOP]