Copy link to clipboard
Copied
I'm quite sure this question has been asked and answered -- happy to look at any existing threads I've missed or expressions I may not have tried.
Obviously, new to expressions here. I'm working on a lower third that's made up of two text layers:
Layer 1| Layer 2
Layer 1 has a different line weight and size than Layer 2. I want to export a .mogrt where Layer 2's position will change, relative to the ending position of Layer 1. in the .mogrt, source text will be editable in both layers.
Thanks for any advice and patience with a simple question.
Copy link to clipboard
Copied
The approach to this kind of problem is to tie the position of text layer 2 to text layer 1 with an expression that looks at the position of layer 1 and calculates the true position of the text block in layer 1 using sourceRectAtTime() and then uses the left, width, top, and height as well as the sourceRectAtTime() properties of the text layer 2 to adjust the position of layer 2 while compensating for baseline shift (top + height) and paragraph justification (left and width). You only need an expression for Laye2, and I would use thisComp.layer(index - 1) instead of the layer's name in the composition. You have to do the math so the second layer goes where you want it to go, plus a bit of padding.
Try something like this to make layer 2's baseline line up with Layer 1's baseline and position Layer 2 to the right of layer 1.
L2 = sourceRectAtTime();
L1 = thisComp.layer(index -1);
pad = 30;
p = L1.position;
s = L1.sourceRectAtTime();
x = s.width + s.left;
y = s.height + s.top;
p + [x + L2.left + pad, 0];
As long as you have not fiddled with Baseline Shift and the second text layer, Paragraph justification is set to Left, that expression should keep things lined up and both layers at the same level.
Copy link to clipboard
Copied
Copy link to clipboard
Copied
The expression assumes that there is no baseline shift and that you don't want to line up the defenders on the second layer. If I were building a MOGRT, I would add a slicer to fine-tune the offset and another one for the padding.
Copy link to clipboard
Copied
Mmm this is great, but what if you want
Layer1
Layer2
And if layer1 gets 2 sublines of text. ; layer2 moves down automaticly?
Layer1 (line1)
Layer1 (line2)
Layer2
Get ready! An upgraded Adobe Community experience is coming in January.
Learn more