Adobe After Effects CC 2024: How To Create Auto-Resize Text Boxes

This tutorial will show you how to add the sourceRectAtTime Expression to the Size Property of a Shape to create auto-resizing text boxes in Adobe After Effects CC 2024.

Keyboard Shortcuts:

F2: Deselect All Layers
SS: Solo Property


Final Tutorial Expression:
w= thisComp.layer(index+1).sourceRectAtTime().width;
h= thisComp.layer(index+1).sourceRectAtTime().height; [w,h];

To try or buy Adobe After Effects CC 2024: (affiliate link)

⭕️ Check out my new Domestika Course on Adobe Audition:


00:00 Intro: About The Tutorial
00:22 Add Text
00:34 Align Text + Anchor Point
00:44 Create Shape Layer
00:58 Fill & Stroke
01:13 Uncheck ‘Bezier Path’
01:34 Rectangle Size Property
01:51 Solo Property
02:03 Width & Height
02:15 Add Expression
02:29 Add Width Variable
03:04 Add Height Variable
03:29 Add Array
03:59 Add Padding
04:32 Change Layer Name To Index
04:58 Fix: Lock Anchor Point

Software Used:
Adobe After Effects CC 2024 (Click To Try or Buy)

How To Use sourceRectAtTime Expression:

  1. Create New Composition
  2. Add Parametric Shape (uncheck Bezier Path)
  3. Add Text Layer Below Shape Layer
  4. Twirl open Shape Layer and locate ‘Size’ Property
  5. Hold Option/Alt key and click on stopwatch for ‘Size’ Property
  6. Add variable
  7. w= thisComp.layer(index+1).sourceRectAtTime().width+100;
  8. h= thisComp.layer(index+1).sourceRectAtTime().height+100;
  9. Add Array: [w,h];
  10. Shape should fit around Text with some padding (+100)

How To Add Fix Alignment Issue:

  1. Open Effects & Presets Panel
  2. Search for ‘Anchor Point’
  3. Drag ‘Lock Ancho Point’ on Shape & Text Layer
  4. Fixed!

Questions, Comments, Feedback?

My Gear List:

My Amazon Store:

My YouTube Channel: