How To Create Auto-Resize Text Boxes in After Effects (sourceRectAtTime)
June 26, 2024 · Mike Murphy
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.
Adobe After Effects CC 2024: How To Create Auto-Resize Text Boxes
**Description:
**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
Expression:
sourceRectAtTime()
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:
https://mikemurphy.co/adobe (affiliate link)
⭕️ Check out my new Domestika Course on Adobe Audition:
https://mikemurphy.co/domestika
——————
Chapters:
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:
- Create New Composition
- Add Parametric Shape (uncheck Bezier Path)
- Add Text Layer Below Shape Layer
- Twirl open Shape Layer and locate ‘Size’ Property
- Hold Option/Alt key and click on stopwatch for ‘Size’ Property
- Add variable
- w= thisComp.layer(index+1).sourceRectAtTime().width+100;
- h= thisComp.layer(index+1).sourceRectAtTime().height+100;
- Add Array: [w,h];
- Shape should fit around Text with some padding (+100)
How To Add Fix Alignment Issue:
- Open Effects & Presets Panel
- Search for ‘Anchor Point’
- Drag ‘Lock Ancho Point’ on Shape & Text Layer
- Fixed!