Trouble With Auto-Sizing Text Box

Participant ,
Apr 01, 2022 Apr 01, 2022

Copy link to clipboard

Copied

I've used these expressions before with no trouble but clearly something is different this time. I've tried adding it to all the different Scale and Size properties within the Box layer but they all either extend left to right forever or they scale wrong. Either it's growing too fast, or it shrinks as I type. Can anyone spot what is causing this?

Capture.PNG

Capture 1.PNG

  

TOPICS
Error or problem , Expressions

Views

117

Likes

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

correct answers 2 Correct answers

Community Expert , Apr 01, 2022 Apr 01, 2022

It looks like your x scale for the layer is set to -4674.3. Maybe that's the issue?

Likes

Translate

Translate
Participant , Apr 01, 2022 Apr 01, 2022

Yes I think that had something to do with it. I created a new rectangle from scratch and was able to get it to work by changing the value in parenthesis of the expression for sourceRectTime to 2 so it didn't get thrown off by the animation at the beginning. And the new text box doesn't have such an extreme x value. Initially, I tried a new approach which created groups within the layer and I think that got messed up.

Likes

Translate

Translate
Participant ,
Apr 01, 2022 Apr 01, 2022

Copy link to clipboard

Copied

Also, should have maybe added the expressions I used-

 

s=thisComp.layer("Your Text Title Name Here");

 

w=s.sourceRectAtTime().width;

h=s.sourceRectAtTime().height;

 

[w,h]

 

Also tried -

 

dname=thisComp.layer("name").sourceRectAtTime(time).width;

Value+[dname,0]

Likes

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 ,
Apr 01, 2022 Apr 01, 2022

Copy link to clipboard

Copied

Have you tried applying the expression to rectangle path's Size property?

Likes

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
Participant ,
Apr 01, 2022 Apr 01, 2022

Copy link to clipboard

Copied

Yes. Something is throwing it off. I'm wondering if it has to do with the animation I added.

Likes

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
Participant ,
Apr 01, 2022 Apr 01, 2022

Copy link to clipboard

Copied

This is another attempt, this should be the size of my text but this is what I get.

Capture2.PNG

Likes

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
Participant ,
Apr 01, 2022 Apr 01, 2022

Copy link to clipboard

Copied

A slightly different expression creates an infinite width

Capture3.PNG

Likes

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 ,
Apr 01, 2022 Apr 01, 2022

Copy link to clipboard

Copied

In your other posts, it looks like you have adjusted the scale values of both the box's group and layer transforms. Is that still the case?

Likes

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
Participant ,
Apr 01, 2022 Apr 01, 2022

Copy link to clipboard

Copied

Here are the current values

Capture5.PNG

Capture4.PNG

Likes

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 ,
Apr 01, 2022 Apr 01, 2022

Copy link to clipboard

Copied

It looks like your x scale for the layer is set to -4674.3. Maybe that's the issue?

Likes

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
Participant ,
Apr 01, 2022 Apr 01, 2022

Copy link to clipboard

Copied

LATEST

Yes I think that had something to do with it. I created a new rectangle from scratch and was able to get it to work by changing the value in parenthesis of the expression for sourceRectTime to 2 so it didn't get thrown off by the animation at the beginning. And the new text box doesn't have such an extreme x value. Initially, I tried a new approach which created groups within the layer and I think that got messed up.

Likes

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