Skip to main content
Participant
June 17, 2022
Question

Expanding text box (with 2 text layers).

  • June 17, 2022
  • 1 reply
  • 74 views

Hi all. I hope you can help. I have made an expanding text box using a size expression, but I can only get it working with 1 text layer. I need it to work with 2 separate text layers. This means the text layer 1 would need to push the text layer 2 down to avoid any overlap.

Thank you anyone who takes the time to look at this!

Please see image to explain.

 

 

This topic has been closed for replies.

1 reply

Mylenium
Legend
June 17, 2022

You simply have to compare the sizes of the two text blocks using if()else() or simply have them filtered through a Math.max(). The rest is just the standard sourceRectAtTime() stuff times two. So simple example:

 

mTextA=thisComp.layer("Text A").sourceRectAtTime();
mTextB=thisComp.layer("Text B").sourceRectAtTime();
mPad=5;

if(mTextA[0] >= mTextB[0])
{mWidth=mTextA+mPad*2}
else
{mWidth=mTextB+mPad*2};

mHeight=mTextA[1]+mTextB[1];

[mWidth,mHeight]

 

Mylenium