-
Make a Text Box Resize to the Longer of 2 Text Layers
Hello creative community!
I am trying to make an editable lower third with 2 lines of text that are different colors/fonts/sizes, and a text box that resizes to the longer of the 2 lines.
Attempt 1:
I thought I had accomplished this by having both lines of text in a single text layer, and an expression on the text box’s size (code is pasted below). It worked swimmingly. However, when I took my AE composition into Premiere and changed the text (under effects controls), suddenly the text in the second line was the same color/font/size as the top line.Attempt 2:
I tried solving this by separating my 2 lines of text into 2 text layers, then I hard-coded the height of the text box (85). But I still don’t know how to make the text box width resize correctly. Sometimes the talent’s name is longer, sometimes their title is longer, so I need the text box to be as wide as the widest line of text.So my question is:
Can I make one layer look at 2 other layers and match whichever one is wider? Would this involve an else/if expression? Thanks in advance!m = 30
myText = thisComp.layer("Text").sourceRectAtTime();
myTextWidth = myText.width + m;
myTextHeight = myText.height + m;[myTextWidth, myTextHeight]; // Note: in Attempt 2, I hard-coded 85 instead of using myTextHeight