Exit
  • Global community
    • Language:
      • Deutsch
      • English
      • Español
      • Français
      • Português
  • 日本語コミュニティ
  • 한국 커뮤니티
0

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

New Here ,
Oct 15, 2025 Oct 15, 2025

 

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!

TOPICS
Expressions
208
Translate
Report
Community guidelines
Be kind and respectful, give credit to the original source of content, and search for duplicates before posting. Learn more
community guidelines

correct answers 1 Correct answer

Community Expert , Oct 15, 2025 Oct 15, 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

...
Translate
Community Expert ,
Oct 15, 2025 Oct 15, 2025

Fixed at the bottom of what?

Translate
Report
Community guidelines
Be kind and respectful, give credit to the original source of content, and search for duplicates before posting. Learn more
community guidelines
New Here ,
Oct 15, 2025 Oct 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.

Translate
Report
Community guidelines
Be kind and respectful, give credit to the original source of content, and search for duplicates before posting. Learn more
community guidelines
Community Expert ,
Oct 15, 2025 Oct 15, 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.

 

Translate
Report
Community guidelines
Be kind and respectful, give credit to the original source of content, and search for duplicates before posting. Learn more
community guidelines
New Here ,
Oct 16, 2025 Oct 16, 2025
LATEST

That’s exactly what I was looking for, it works perfectly!
Many thanks for your help! 🙏

Translate
Report
Community guidelines
Be kind and respectful, give credit to the original source of content, and search for duplicates before posting. Learn more
community guidelines