Skip to main content
Participating Frequently
December 23, 2021
Question

How can you create a responsive lower-third that has an image and text, that stays centred align?

  • December 23, 2021
  • 3 replies
  • 1004 views

Hey, how can you create a lower-third that has a thumbnail image and text that is horizontal aligned with padding, that is responsive when you type but stays centred aligned on the composition?

This topic has been closed for replies.

3 replies

Community Expert
December 24, 2021

Here are the expressions. Add this one to the text layer position:

 

hPad = effect("H Padding")("Slider");
graphic = thisComp.layer(index + 1);
graphicsrc=graphic.sourceRectAtTime();
graphicScale = graphic.scale[0] * .01;
graphicCenter = graphic.width/2 * graphicScale;
txtHeight = thisLayer.sourceRectAtTime().height;
txtTop = thisLayer.sourceRectAtTime().top;
txtCenter = txtHeight/2;

x = graphic.position[0] + graphicCenter + hPad;
y = graphic.position[1] - txtTop - txtCenter;
[x, y]

 

The only usable sourceRectAtTime() value for a solid, image, or footage layer is width. An expression control slider to give some padding to the text I have added an Expression Control Slider. The expression calculates the size of the graphic layer and compensates for the height of the text layer to keep the text layer centered vertically on the graphic layer and following the layer's position. I used index instead of the layer name so the expression always works as long as the graphic layer is below the text layer.

 

This is the expression for the graphic layer:

 

txtsrc=thisComp.layer(index - 1).sourceRectAtTime();
txtWidth = txtSrc.width + thisComp.layer(index - 1).effect("H Padding")("Slider");
srcWidth = thisLayer.sourceRectAtTime().width;

x = thisComp.width/2 - txtWidth / 2;
y = value[1];
[x, y]

 

It takes the width of the text layer plus the padding and subtracts half the width of the text layer plus the padding from the horizontal position and maintains the Y position. The graphic layer and text layer will now always be centered no matter what the size of the text layer and you can scale the graphic if needed. The only thing you need to do to make sure this pair of expressions always work is to make sure that the graphic layer is always the same size as the graphic. Transparency can foul that up.

 

I am attaching a project file for you to look at. Just replace the solid with any graphic and it should work just fine. I suggest you save these two expressions as an Animation preset. I did.

 

https://www.dropbox.com/s/q0o36qyndje3pn4/Centered%20Text%20and%20Graphic.aep?dl=0

Mathias Moehl
Community Expert
Community Expert
December 24, 2021

If you use Pins & Boxes, this tutorial shows a very good technique and works with centering all kinds of layouts:

If you created your dynamic layout already without Pins & Boxes, you can also use Pins & Boxes just for the centering (you can create pins around your existing content, no matter what it is).

Mathias Möhl - Developer of tools like BeatEdit and Automation Blocks for Premiere Pro and After Effects
Community Expert
December 24, 2021

I don't have time to give you the whole workflow but this kind of thing is fairly straightforward using expressions.

 

sourceRectAtTime() will return the width of the text layer. You can add padding and a bunch of other things to that. You can also retrieve the top, height, and left edge. 

 

Combine that with retrieving the layer size and using [thisComp.width, thisComp.height]/2 to find comp center and you have got the solution. When you get it you can create a MOGRT for use in Premiere Pro using the Extended Graphics workspace. 

 

If I get some free time later I will post some expressions and examples. I'll let you know.