If you've been making subtitles in After Effects like me, you probably found out that sometimes you need the text layer to be aligned vertically. This is not an issue if you only have one line of text. But as soon as you have two lines or more, you have to adjust the position to align it again.
I've had my fair share of manually fixing this until I discovered a simple expression that works like magic. Whatever you type, the text will always be vertically aligned.
To get the best results, you should create a text box instead of just a text. You do this by selecting the text tool and instead of just clicking on the composition, you're gonna click and drag to create a box. When you give the text box a specific width, your text will have line breaks automatically once it reaches the edge. This makes the work easier.
Type whatever you want inside your textbox, and open the layer properties until you see the Anchor Point. You can also select the layer and just press "A" to see it.
We need to add an expression in the Anchor Point property by pressing ALT and clicking on the stopwatch icon, this will open a small code editor where we need to type the following:
a=sourceRectAtTime();
[0,a.top+a.height/2]+value
The anchor point of the layer will adjust itself depending on the height of the text, not the textbox, with the ability to change it manually if needed thanks to the "value" parameter.
And that should do it!
No Comments.