View all expressions
Conditional

Responsive Text Layout Based on Composition Width

Automatically adjusts the width of a text box based on the composition’s width. The text scales responsively without any sliders — fully adaptive and resolution-independent.

Contributed by:


// Add to Source Text
textSize = 50;
// Font size
textLeading = 1;
// Line spacing (leading)
originalBoxWidth = 1920;
targetWidth = thisComp.width;
boxScale = targetWidth / originalBoxWidth;
text.sourceText.style.setFontSize(textSize / boxScale).setLeading(textSize * textLeading / boxScale);
// Add to Scale
targetWidth = thisComp.width;
originalBoxWidth = 1920;
boxScale = targetWidth / originalBoxWidth;
value * boxScale;

Responsive Text Layout Based on Composition Width

Practical use case

Ideal for video templates and automation setups with multiple aspect ratios. Ensures text always fits within the comp without needing to adjust anything manually across versions.

Check out similar expressions

Data-driven video workflows for After Effects are easier with Plainly.

a mesh of elegant lines transparent image