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

setTextWidth

Explorer ,
Jun 30, 2022 Jun 30, 2022

Copy link to clipboard

Copied

Is there a way to set the width of a block of paragraph text via expressions?

 

Looked in the docs, but no such funtion exists.

 

 

TOPICS
Expressions

Views

132

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 ,
Jun 30, 2022 Jun 30, 2022

Copy link to clipboard

Copied

I don't think there's any way to do that with an expression.

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 ,
Jun 30, 2022 Jun 30, 2022

Copy link to clipboard

Copied

There's no direct expression access to that function (probably possible with scripting, but likely wouldn't be the elegant solution you're hoping for). 

The solutions for this are usually a bit hacky and annoying - fortunately, I recently stumbled onto this preset, which makes it easy! https://rossowens.gumroad.com/l/textbox

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
Explorer ,
Jun 30, 2022 Jun 30, 2022

Copy link to clipboard

Copied

that's interesting, thanks

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 ,
Jun 30, 2022 Jun 30, 2022

Copy link to clipboard

Copied

LATEST

The only thing you could do with expressions would be to tie the layer's scale to the sourceRectAtTime().width of the layer so that the true size would always be the same. Two words would scale up until they were 500 pixels wide, and four words would scale down until they were 500 pixels wide. I almost never write an expression using sourceRectAtTime() that does not combine ".left, .right, height, width and scale * .01" to compensate for layer scale. It should not be difficult to reverse the process. You could not force a line feed, but you could keep a text layer the same width no matter how many characters were in it. It might be an interesting visual effect. 

 

Here's the basic starting point for all my sourceRectAtTime() expressions.

ref = thisComp.layer(index - 1);
refPos = ref.position;
refSize = ref.sourceRectAtTime();
xOfst = refSize.width / 2 + refSize.left;
yOfst = refSize.height / 2 + refSize.top;

x = xOfst;
y = yOfst;


refPos + [x, y]

The expression centers the Anchor point of any layer below a text layer over the center of the text.

 

If you want to fiddle with expressions maybe that will get you started.

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