Skip to main content
Participant
Oct 15, 2025 3:53 PM UTC
Answered

How to keep text fixed at the bottom with an automatic offset (regardless of characters)?

 

Hey everyone,

I’m using the following After Effects expression:

 
var rect = thisLayer.sourceRectAtTime(time, false); var pos = transform.position; var offset = 20; pos - [0, rect.height - offset];
 

It works, but I’d like the text to stay fixed at the bottom no matter what characters are used — uppercase, lowercase, umlauts, or special symbols — and I’d like the offset to adjust automatically (so I don’t have to set it manually).

Right now, the position still changes slightly depending on the text content.
Does anyone know how to modify the expression so the text baseline always stays perfectly fixed at the bottom with an automatic offset?

Thanks in advance!

Dan Ebberts
Dan EbbertsCorrect answer
Community Expert
Oct 16, 2025 12:22 AM UTC

I'm still not exactly sure what you mean, but if you mean that if you add characters with descenders (g, y,p, etc.) that the bottom of the text remains at the same y position as text without descenders, that's tricky, but I think there's a way to do it.

If you add this expression to your source text:

time < 0 ? "m" : value

It will provide a no-descender reference for your position expression at times less than zero (so it won't mess up your visible text). Then add a position expression like this:

r1 = sourceRectAtTime(-1,false);
r2 = sourceRectAtTime(time,false);
delta = (r1.top+r1.height) - (r2.top+r2.height);
value + [0,delta]

Play around with it and see if it helps.

 

4 replies

Dan Ebberts
Community Expert
Community Expert
Oct 15, 2025 4:26 PM UTC

Fixed at the bottom of what?

Translate
Participant
Oct 15, 2025 4:31 PM UTC

I mean fixed to the bottom edge of the text itself (the baseline or lower edge, see the guide line in my screenshot).
So when the text changes, it should only grow upwards, not move downwards.

Translate
Dan Ebberts
Community Expert
Dan EbbertsCommunity ExpertCorrect answer
Community Expert
Oct 16, 2025 12:22 AM UTC

I'm still not exactly sure what you mean, but if you mean that if you add characters with descenders (g, y,p, etc.) that the bottom of the text remains at the same y position as text without descenders, that's tricky, but I think there's a way to do it.

If you add this expression to your source text:

time < 0 ? "m" : value

It will provide a no-descender reference for your position expression at times less than zero (so it won't mess up your visible text). Then add a position expression like this:

r1 = sourceRectAtTime(-1,false);
r2 = sourceRectAtTime(time,false);
delta = (r1.top+r1.height) - (r2.top+r2.height);
value + [0,delta]

Play around with it and see if it helps.

 

Translate