
How to create a dynamic text box?
-
- Create a text layer and rename it to textLayer.
- Create a rectangular shape.
- Alt-click on the Size property and paste the expression below.
Get 10% off when you subscribe to our newsletter
By subscribing you agree to your email being stored and used
to receive the emails in accordance to our Privacy Policy

// edit horizontal padding in pixels
var horizontalPadding = 100;
// edit vertical padding in pixels
var verticalPadding = 50;
// text layer
var textLayer = thisComp.layer("textLayer");
// bounding box around text
var bbox = textLayer.sourceRectAtTime(time,true);
// box’s width + padding
[bbox.width * textLayer.scale[0] / 100,
bbox.height * textLayer.scale[1] / 100] +
[horizontalPadding, verticalPadding]
- Alt-click on the Position property and paste the expression below.
var textLayer = thisComp.layer("textLayer");
var box = textLayer.sourceRectAtTime(time, false);
textLayer.position - textLayer.anchorPoint +
[box.left*textLayer.scale[0] / 100,
box.top * textLayer.scale[1] / 100] +
[box.width * textLayer.scale[0] / 100,
box.height*textLayer.scale[1] / 100] / 2;
How to make a box round?
Open Roundness property of the shape box and increase the value.
How to change padding?
Change horizontalPadding and verticalPadding in the first expression.