1

I'm building a Mogrt using After Effects. I need to be able to drive the size of a paragraph text box dynamically using expressions.

Is that possible? I can't find a parameter related to this.

0

1 Answer 1

0

It's not possible directly from what I understand, but you can make a "faux text box" and alter the scale while inversely altering the text size and leading.

For example, add a paragraph text box and resize it (closely) to 1920x1080. Drag the anchor to the upper left corner. The anchor point will be the point the text box scales from. Then add 3 sliders to the text layer: FontSize, TextBoxWidth, and FontLeading. Set these sliders to arbitrary values to start, maybe 16 for FontSize, 800 for TextBoxWidth, and 1.6 for FontLeading.

Add this as the Source Text expression

textSize = effect("FontSize")("Slider");
targetWidth = effect("TextBoxWidth")("Slider");
textLeading = effect("FontLeading")("Slider");
originalBoxWidth = 1920;

boxScale = targetWidth / originalBoxWidth;

text.sourceText.style.setFontSize(textSize / boxScale).setLeading(textSize * textLeading / boxScale);

Add this expression to Transform > Scale of the text layer.

targetWidth = effect("TextBoxWidth")("Slider");
originalBoxWidth = 1920;

boxScale = targetWidth / originalBoxWidth;

value * boxScale;

You'll then be able to adjust the sliders to set the text box width, font size, and leading.

See this video for more details:

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service and acknowledge you have read our privacy policy.

Not the answer you're looking for? Browse other questions tagged or ask your own question.