Copy link to clipboard
Copied
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.
Copy link to clipboard
Copied
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
Find more inspiration, events, and resources on the new Adobe Community
Explore Now