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

Expanding text box (with 2 text layers).

New Here ,
Jun 17, 2022 Jun 17, 2022

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.

Timothy2368285548cu_1-1655460061345.png

 

 

TOPICS
Expressions , How to , Scripting
70
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
LEGEND ,
Jun 17, 2022 Jun 17, 2022
LATEST

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

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