View all expressions
Transformation

Dynamic Text Box

Dynamically adjusts the size of a text box based on the width and height of another text layer, adding padding.


// Shape layer size property
subText = thisComp.layer("index-1");
textWidth = subText.sourceRectAtTime(time).width + 100;
textHeight = subText.sourceRectAtTime(time).height + 100;
[textWidth, textHeight]
// Text layer anchor point
top = sourceRectAtTime().top;
left = sourceRectAtTime().left;
x = left + (sourceRectAtTime().width / 2);
y = top + (sourceRectAtTime().height / 2);
[x,y]

Dynamic Text Box

Practical use case

Automatically resizes a background box to fit around changing text, ensuring consistent padding for labels, buttons, or captions.

Check out similar expressions

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

a mesh of elegant lines transparent image