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

Set background of entire paragraph text box

New Here ,
Jul 21, 2023 Jul 21, 2023

I have a paragraph text box and I want to set the background of exactly the text box. I have seen solutions where you set the background of the text only, or apply a blur and fill, but these options do not match the exact dimensions of the box.

 

I also know you could make a seperate layer and attach it to the text layer but I would like to avoid this as it would extra work for every text layer I have.

 

Is there an easier way to set the entire background of a paragraph text box?

TOPICS
Error or problem , How to
705
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 ,
Jul 21, 2023 Jul 21, 2023

No, there isn't. You have to use sourceRectAtTime() on a separate layer matching the text and all that jazz. There isn't even a proper expression method to access the actual paragraph box, do you can stop looking. It needs to be done the hard way.

 

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
Community Expert ,
Jul 21, 2023 Jul 21, 2023

Unfortunately, there is no way to extract the size of a text box directly. There is a hack that will allow you to use sliders to scale the text layer and adjust the font size to make it look like you are controlling the size of the text box. Here's the tutorial, it might give you some ideas.

If you want to stick with a text box you have already drawn and you add Effects/Expression Controls/Point Control to the text layer, these expressions on a Shape Layer with a simple Rectangle will work as long as the Shape Layer 1/Contentes/Rectangle 1/Transform Rectangle 1 properties are all at their default values:

//Contents/Rectangle 1/Size
thisComp.layer(index-1).effect("Box Size")("Point")

//Contents/Rectangle 1/Position
ref = thisComp.layer(index - 1);
box = content("Rectangle 1").content("Rectangle Path 1").size;
crnr = ref.sourceRectAtTime();
[crnr.left , crnr.top] + box/2;

//Shape Layer 1/Transform/Position
ref = thisComp.layer(index - 1).position;

 I have not allowed for padding on the background layer.  You could do a little math, or you could just add a stroke to the Rectangle that was the same color tied to an Expression Controls/Slider Control on the text layer. 

 

That would give you the opportunity to draw a Text Box on any text layer, then adjust the size of the text box background using the Point Control on the text layer. 

 

I don't have time right now to review the scale of the layer expressions and use that trick to position a background layer behind the text box, but that could also be done. If I get time later today, I'll fiddle with that. Here's my solution with a couple of extra Expression Controls:

RickGerard_0-1689975527860.gif

 

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
Community Expert ,
Jul 24, 2023 Jul 24, 2023
LATEST

If you want just the dimensions of the text box, and no extra, then a combination of Shift Channels, Fill and CC Composition should get you there:

helped.jpg

 

Note the text box handles are in the corners of the filled space.

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