ADOBE AFTER EFFECTS: Forum Expressions Tutorials Creative Cloud

Need to sync caption position to self-resizing lower third

COW Forums : Adobe After Effects Expressions

<< PREVIOUS   •   FAQ   •   VIEW ALL   •   PRINT   •   NEXT >>
Giancarlo Hernandez
Need to sync caption position to self-resizing lower third
on Nov 10, 2018 at 9:06:15 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]


Return to posts index

Kalleheikki Kannisto
Re: Need to sync caption position to self-resizing lower third
on Nov 11, 2018 at 10:45:36 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


Return to posts index

Giancarlo Hernandez
Re: Need to sync caption position to self-resizing lower third
on Nov 12, 2018 at 4:34:56 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]


Return to posts index


Kalleheikki Kannisto
Re: Need to sync caption position to self-resizing lower third
on Nov 12, 2018 at 8:33:11 pm
Last Edited By Kalleheikki Kannisto on Nov 12, 2018 at 8:34:34 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


Return to posts index

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