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

Auto Re-Sizing Text Boxes using sourceRectAtTime

New Here ,
May 15, 2018 May 15, 2018

Copy link to clipboard

Copied

Hello

I've been using the sourceRectAtTime expression to create some auto-resizing text boxes for a template I'm creating.

But i've run into difficulties when using accented letters (i.e. ¿CÓMO ESTÁS?) because it changes the heights of the box

I need t keep a fixed height regardless of whether I use accented letters or overhangs (J) or underhangs (y).

I also need the space/leading between each line of text to remain constant and not vary depending on what letters I enter.

Basically, how do I fix the height of the text boxes and only have the width variable? I've attached some screenshot to illustrate the problem.

Screen Shot 2018-05-15 at 15.54.32.png

Screen Shot 2018-05-15 at 15.50.06.png

Views

1.8K

Translate

Translate

Report

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 ,
May 15, 2018 May 15, 2018

Copy link to clipboard

Copied

Nothing stops you from assigning a fixed value inside your expressions instead of your variables. Simply use e.g. [200,t-o] or whatever those values actually are.

Mylenium

Votes

Translate

Translate

Report

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
New Here ,
May 15, 2018 May 15, 2018

Copy link to clipboard

Copied

Thanks

But I don't think that solves the problem.

The height still varies depending on the type of letter I enter .Also, if I then want to scale the text the box won't scale with it.

Votes

Translate

Translate

Report

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 ,
May 15, 2018 May 15, 2018

Copy link to clipboard

Copied

sourceRectAtTime takes into account ascending and descending characters, font size differences and a bunch of other things. It also will read the size of a text box or text area that you draw. If you need the height of the box to stay the same just define the Y value in your expression.

If you want to make everything scale then you need to add a reference the scale value of the layer or the scale value of a text animator.

Votes

Translate

Translate

Report

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
New Here ,
May 16, 2018 May 16, 2018

Copy link to clipboard

Copied

Hi

I can't seem to get it to work. If i fix the height the box then shifts when i enter new text.

Any ideas?

Votes

Translate

Translate

Report

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 ,
May 16, 2018 May 16, 2018

Copy link to clipboard

Copied

What do you mean it shifts when you enter new text? I mean, it is expected that the size will change.

Votes

Translate

Translate

Report

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
New Here ,
May 16, 2018 May 16, 2018

Copy link to clipboard

Copied

I mean the box shifts off-centerScreen Shot 2018-05-16 at 12.48.14.png so it's not aligned with the text anymore

Votes

Translate

Translate

Report

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 ,
May 16, 2018 May 16, 2018

Copy link to clipboard

Copied

What does your expression on the box's position look like?

Votes

Translate

Translate

Report

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 ,
May 16, 2018 May 16, 2018

Copy link to clipboard

Copied

I created one couple of weeks ago

Note (expressions are universalized)

used this for POSITION :

content("Rectangle 1").content("Rectangle Path 1").size/2

t = thisComp.layer("Centered Text SC");

tRect = t.sourceRectAtTime(time,false);

tUL = t.toComp([tRect.left,tRect.top]);

tLR = t.toComp([tRect.left+tRect.width,tRect.top+tRect.height]);

tCenter = (tUL + tLR)/2

myRect = sourceRectAtTime(time,false);

myUL = toComp([myRect.left,myRect.top]);

myLR = toComp([myRect.left+myRect.width,myRect.top+myRect.height]);

myCenter = (myUL + myLR)/2

delta = myCenter - tCenter;

value - delta

and this for SIZE :

s = thisComp.layer("Centered Text SC");

thePadding = thisComp.layer("Controller").effect("Padding-Space")("ADBE Slider Control-0001");

x = s.sourceRectAtTime(time-s.inPoint,true).width +(thePadding*2)+thisComp.layer("Controller").effect("left-Right-Space")("ADBE Slider Control-0001") ;

y = s.sourceRectAtTime(time-s.inPoint,true).height +(thePadding*2)+thisComp.layer("Controller").effect("Top-Bottom--Space")("ADBE Slider Control-0001") ;

[x,y]

Votes

Translate

Translate

Report

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
New Here ,
May 16, 2018 May 16, 2018

Copy link to clipboard

Copied

Thanks .I will give this a try .

Does this work for accented letters then, like in my example above?

Votes

Translate

Translate

Report

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 ,
May 16, 2018 May 16, 2018

Copy link to clipboard

Copied

LATEST

I guess for the accented letters there must be something like the Math.round

for decimal numbers, but I really don't know. Check Dan Ebberts

Votes

Translate

Translate

Report

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