Creative Communities of the World Forums

The peer to peer support community for media production professionals.

Activity › Forums › Adobe After Effects Expressions › Need to sync caption position to self-resizing lower third

  • Need to sync caption position to self-resizing lower third

    Posted by Giancarlo Hernandez on November 10, 2018 at 9:06 pm

    Hey everybody, I am wondering if anyone in the forum has experience with messing around with expressions in After Effects. I needed to find a way to create self-resizing lower thirds so I looked up some tutorials on youtube that could help me. I managed to get the main header to work the way I wanted it. The problem is that I have to place a caption underneath the header (for example, HEADER: Chris Richards, Caption: Vice President). This composition is meant to be used as a template that can be edited in Adobe Premiere, so whenever someone would type a new name in, I would want the caption to be right aligned (flush right) under the name in the text box. My dilemma is that I don’t know how to scribe an expression that would move the captions position in accordance with the finishing of the header. if anybody can help me out, I would greatly appreciate it. Attached are some images of the project file.

    title = thisComp.layer("Rectangle").sourceRectAtTime();padding = effect("Padding")("Slider");[title.width + padding, title.height + padding]

    temp = content("Rectangle 1").content("Rectangle Path 1").size[0];
    [temp/2, 0]

    Kalleheikki Kannisto replied 7 years, 10 months ago 2 Members · 3 Replies
  • 3 Replies
  • Kalleheikki Kannisto

    November 11, 2018 at 10:45 am

    If I understand your construction correctly, it would be like this for the caption position:

    title = thisComp.layer("Rectangle").sourceRectAtTime();
    padding = effect("Padding")("Slider");
    value + [title.width + padding, 0]

    In order for this to work, the caption layer paragraph needs to be right aligned (with the anchor point at the right edge) and it needs to be aligned to the right edge of the Title layer to begin with. This only changes the relative position based on the text width, so it needs to be correctly placed at the start.

    Not tested, but theoretically should work.

    Kalleheikki Kannisto
    Senior Graphic Designer

  • Giancarlo Hernandez

    November 12, 2018 at 4:34 am

    Hey, Kalleheikki your solution actually solved the problem. I had to modify the expression a bit, it’s as follows:

    If you don’t mind me asking, can you decipher what some of these terms are? I’m new to expression so this all really new to me but I’m really interested in learning.

    title = thisComp.layer("Rectangle").sourceRectAtTime();
    value + [title.width, 0]

  • Kalleheikki Kannisto

    November 12, 2018 at 8:33 pm

    Sure, it’s pretty simple.

    title is a variable
    thisComp is the current composition
    layer(“Rectangle”) retrieves the layer named “Rectangle” within that comp
    sourceRectAtTime() returns the location and size of the layer (top, left, width, height) at a give time (usually the current time, but not always)
    value is the current value of the property being accessed
    title.width retrieves the width of the layer “Rectangle” (because that is what is assigned to the variable title)
    [ ] (brackets) are used to create or access an array. Position is an array with 2 items, x and y.

    So, long story short, we’re just adding the width of the layer “rectangle” to the current position.

    The AE expression reference will give you more details.

    Kalleheikki Kannisto
    Senior Graphic Designer

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