Happy Holidays United States Sale! Feb 5th Only! Save 50% Sitewide!
Special Offer Buy Every Package for $8412 $149
You save $8263 (99% off)

Dynamic Text Box in After Effects

How to create a dynamic text box?

    1. Create a text layer and rename it to textLayer.
    2. Create a rectangular shape.
    3. Alt-click on the Size property and paste the expression below.
// 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] 
    1. 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.

Welcome to AEJuice Points
Become a member
With more ways to unlock exciting perks, this is your all access pass to exclusive rewards.
Already have an account? Sign in
AEJuice Points
Earn more AEJuice Points for different actions, and turn those points into awesome rewards!
Give your friends a reward and claim your own when they make a purchase.
They get
$15 off discount
You get
$15 off discount
AEJuice Points
Share on Facebook
3 Points
Like on Facebook
1 Point
Follow on Instagram
1 Point
Place an order
3 points for every $100 spent
Celebrate a birthday
2 Points
Ways to spend
Use at checkout
1 Point = $1
Use your points at checkout with any purchase. Points will not expire.