Creative Communities of the World Forums

The peer to peer support community for media production professionals.

Activity Forums Adobe After Effects Position based off right edge of shape

  • Position based off right edge of shape

    Posted by Caleb Nix on April 28, 2020 at 4:43 pm

    Hello all! I need help with some expressions inside of a lower third template I’m creating…

    TL;DR: Looking for expression to animate center of shape from left edge to right edge of dynamic rectangles (responsive to length to text layer) before/at the same time as box’s scale animates from [0,100] to [100,100]

    ——–

    So I have both of my white textbox shape layers (Title Box & Secondary Box) using expressions to be responsive based off of the length of text on the Title Text Layer. Both Title Box and Secondary Box have an offset path (margins) and padding on the right side (room for animation); both of which are controlled independently with expression sliders.

    I’ve been following a post from Adobe Community Support but that solution isn’t working 100%.

    I currently am using this expression on my Teardrop Shape Layer’s position:

    s=thisComp.layer(“Title Text Layer”)
    x=s.sourceRectAtTime(time-s.inPoint,true).width;
    [x, value[1]]

    This works ok (it’s not perfectly aligned but I’ll take it at this point). The problem with this solution comes when the name is shorter or longer than X amount of characters.

    Here is a gif of what I currently have. Again this solution only works with the current text. When a shorter or larger name is added, the shape doesn’t align anymore.

    So I guess my question is: Is there an expression (or group of expressions rather) to find the x value of Title Box at the middle of a sequence { mid=(end-start)/2} and apply that value to the ending position of Teardrop Shape while still having everything scale width-wise if a shorter or longer name is added?

    Thanks!

    Caleb

    Walter Soyka replied 4 years, 5 months ago 3 Members · 3 Replies
  • 3 Replies
  • Walter Soyka

    April 28, 2020 at 6:54 pm

    This expression will return the position, in 2D comp space, of the top-right corner of the referenced shape layer:

    l = thisComp.layer("My Awesome Shape Layer");
    l.toComp([l.sourceRectAtTime(time).left + l.sourceRectAtTime(time).width, l.sourceRectAtTime(time).top]);

    Walter Soyka
    Designer & Mad Scientist at Keen Live [link]
    Motion Graphics, Widescreen Events, Presentation Design, and Consulting
    @keenlive   |   RenderBreak [blog]   |   Profile [LinkedIn]

  • Sami Bayley

    November 30, 2021 at 8:54 am

    Hey Walter! This is great, I’m wondering if theres a way to stick to the bottom right edge instead of top right? Can’t seem to figure it out.

  • Walter Soyka

    November 30, 2021 at 2:31 pm

    Yes, you’ll just have to add the height of the bounding box to the Y position:

    l = thisComp.layer("My Awesome Shape Layer");
    l.toComp([l.sourceRectAtTime(time).left + l.sourceRectAtTime(time).width, l.sourceRectAtTime(time).top + l.sourceRectAtTime(time).height]);

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