Exit
  • Global community
    • Language:
      • Deutsch
      • English
      • Español
      • Français
      • Português
  • 日本語コミュニティ
  • 한국 커뮤니티
0

Need help with Expression problem

New Here ,
May 23, 2025 May 23, 2025

Hej there,

 

I hope someone can help me with this. I attached the project file, so you might lokk for yourselves.

 

I am in the process of creating a lower third template for a client of mine. I'm working in AE, but ultimately want to export the template as a mogrt File to use in Premiere.

 

So, the requirement was to have a dynamic lower third with a particular background shape (rounded rectangle, but one corner to remain 90° – I worked around that by using two shapes and masking) that grows and shrinks with the amount of text that lies on top.

 

I split the text into two layers (Name and Title), so that they can have different fonts and colors when I export them as a mogrt File.

 

With a handful of expressions I got 95% of the way and I think it works, but I can't fix a last issue:

When the lower text layer "Title" consists of more than one line, it expands upwards and collides with / runs behind the upper "Name" layer AND simultaneously pushes the lower edge of the background shapes downwards.

 

Screenshot 2025-05-23 at 09.30.45.png

 

What I want instead, is that, when lines are added to the "Title" layer, the "Name" layer moves upwards accordingly, so that "Name"'s bottom edge and "Title"'s top edge always keep the same distance AND the lower edge of the background shapes never extends downwards.

 

Does anyone have an idea how to mitigate that? 🙂

 

Thanks!

Arcus

 

TOPICS
Expressions , How to
313
Translate
Report
Community guidelines
Be kind and respectful, give credit to the original source of content, and search for duplicates before posting. Learn more
community guidelines

correct answers 1 Correct answer

Community Expert , May 25, 2025 May 25, 2025

The first thing you need to do is line up the anchor points. For left Justified text I use the following expression to put the anchor point at the bottom left corner of any text layer.

txtBox = sourceRectAtTime();
h = txtBox.top + txtBox.height;
w = txtBox.left;
[w, h]

A few more expressions will let you line up the text layers and add a shape layer for the background. Put the shape layer below the text layers and add three sliders named Line Padding, Height Padding, and Width Padding. 

 

Now st

...
Translate
Community Expert ,
May 25, 2025 May 25, 2025

The first thing you need to do is line up the anchor points. For left Justified text I use the following expression to put the anchor point at the bottom left corner of any text layer.

txtBox = sourceRectAtTime();
h = txtBox.top + txtBox.height;
w = txtBox.left;
[w, h]

A few more expressions will let you line up the text layers and add a shape layer for the background. Put the shape layer below the text layers and add three sliders named Line Padding, Height Padding, and Width Padding. 

 

Now stack the text layers using this expression on the bottom text layer's position property:

ref = thisComp.layer(index - 1).position;
txtBox = sourceRectAtTime();

txtH= txtBox.height;
hPad = thisComp.layer("Background").effect("Line Padding ")("Slider");
[ref[0], ref[1] + txtH + hPad];

With the anchor point expressions and the position expression on the bottom text layers you'll get a perfectly lined up couple of text layer separated by the Line Padding value.

 

Now it is time to work on the Shape layer Rectangle and set the Rectangle size. This is the expression for Contents/Rectangle 1/Rectangle 1/Size:

ref1 = thisComp.layer(index - 2).sourceRectAtTime();
ref2 = thisComp.layer(index - 1).sourceRectAtTime();
h = ref1.height + ref2.height;
w = Math.max(ref1.width, ref2.width);
linePad = effect("Line Padding ")("Slider");
hPad = effect("Height Padding")("Slider");
wPad = effect("Width Padding")("Slider");
[w + wPad, h + hPad + linePad];

Then add this expression to the Shape Layer Anchor Point:

p = content("Rectangle 1").content("Rectangle Path 1").size/2;
hPad = effect("Height Padding")("Slider")/2;
wPad = effect("Width Padding")("Slider")/2;
[-p[0] + wPad, p[1] - hPad];

And finish that off with this expression on the Shape Layer Position:

btmRef = thisComp.layer(index - 1).position;

This should give you something like this:

RickGerard_0-1748153946884.png

And a comp that lets you move the top text layer anywhere and make the lines as long as you want. Something like this:

RickGerard_1-1748154407642.gif

I hope you followed the logic of the workflow. 

 

You generated expressions give you the ability to wipe on the text layers, but make no adjustments for multiple layers or line up the anchor points. 

 

I modified your project a little bit, but I don't have the time to clean up the wipe by modifying the code generated by Animation Composer. It's a handy tool, but it creates code that's very difficult to read and modify.  I would probably rewrite the code for the Range Selector/Start. I hope this gets you started.

 

Translate
Report
Community guidelines
Be kind and respectful, give credit to the original source of content, and search for duplicates before posting. Learn more
community guidelines
New Here ,
May 25, 2025 May 25, 2025

Dear @Rick Gerard ,

 

thank you so much for taking the time and breaking everything down for me to understand. I really appreciate that 🙂

Your fixed project is almost perfect! Just 2 things – maybe you even have ideas for that:

 

1) The customer's CD requires that the corners of the background are rounded (easy) except for the upper left corner – that one is supposed to stay at 90°. Unfortunately the corner roundness cannot be modified per corner, which is why in my template I used a second shape layer hidden behind the rounded main shape layer. Any ideas ho to achieve this?

 

2) Do you see a way to have the lower title layer work like in this tutorial ( https://www.youtube.com/watch?v=OxZ_rOkdq8o ) ? Meaning it grows upwards when adding lines and then consequently pushes the Name layer upwards with it.

 

Marc

Translate
Report
Community guidelines
Be kind and respectful, give credit to the original source of content, and search for duplicates before posting. Learn more
community guidelines
New Here ,
May 25, 2025 May 25, 2025

This reply isn't a smackdown. 


https://youtu.be/8h6pwdQJWQA





What you intend to do actually requires a few different solutions. As you already know, there are different problems to sort out. IOW, this requires quite an advanced solution.

For the unique edge design, look at the built-in FFX - 2D Box. It works as a Mask but I'm not sure if it handles more than a single Text Layer. 

To get a Text Layer to move upwards, you will want to place the Anchor Point at the bottom of the text.

I actually conduct a course on crafting this and a lot more complex rigs such as these which I can Intelligent Design Assets. Adobe's Gen Studio Team too calls it Intelligent Design. Assets re-position, re-size and re-animate as content changes. 

You need to be very, very good with Text Layers, Shape Layers and AE and quite a few different Expressions. 

Here are a few samples - 
https://youtu.be/EbKquo94PFs


With scripts, you can set this up in a few minutes - 
https://youtu.be/NzYUQS35rC0


And this sample shows a complex lower third - This set up uses about 60+ Expressions within a single composition. 
https://youtu.be/8h6pwdQJWQA


This set up uses the latest Text Styling which allows multiple fonts per Text Layer. The Expression to the Source Text property is over 500 + lines. It's still performan but what I want to share is that working with Text is really complex and when you want to get pixel-perfect and have multiple text layers and shapes working in unison, you are dealing with a somplex solution.
https://youtu.be/EjNxHIqJ5kU

HTH

 

Translate
Report
Community guidelines
Be kind and respectful, give credit to the original source of content, and search for duplicates before posting. Learn more
community guidelines
Valorous Hero ,
May 25, 2025 May 25, 2025
LATEST

AcccCK! I logged in and posted while on another Adobe Account.   
Apparently, logging in with the correct user account is also a challenge for some of us.  ðŸ˜„

Now, to complete the post - 

Text Layers are complex. Your set up with 2 Text Layers and a Shape Layer is a little over intermediate level but even then as you can see, it's beyond a lot of AE users. So, don't feel bad.  🙂

There are courses outs there and there are specialists out there who can wrap this up in minutes if they don't have a bad hair day, or two. 

Best Wishes


Very Advanced After Effects Training | Adaptive & Responsive Toolkits | Intelligent Design Assets (IDAs) | MoGraph Design System DEV
Translate
Report
Community guidelines
Be kind and respectful, give credit to the original source of content, and search for duplicates before posting. Learn more
community guidelines