Skip to main content
Participant
October 15, 2025
Answered

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

  • October 15, 2025
  • 1 reply
  • 255 views

 

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!

Correct answer Dan Ebberts

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.

 

1 reply

Dan Ebberts
Community Expert
Community Expert
October 15, 2025

Fixed at the bottom of what?

Participant
October 15, 2025

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.

Dan Ebberts
Community Expert
Dan EbbertsCommunity ExpertCorrect answer
Community Expert
October 16, 2025

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.