ADOBE AFTER EFFECTS: Forum Expressions Tutorials Creative Cloud

How do I make this rectangle stay put when it resizes?

COW Forums : Adobe After Effects Expressions

Respond to this post   •   Return to posts index   •   Read entire thread

Al Edwards
How do I make this rectangle stay put when it resizes?
on Jun 8, 2020 at 3:47:51 pm

Hey all! I'm scratching my head over how to solve this. I have a rectangle that automatically resizes to 2 lines of left-aligned text. I'm adapting it to include space for a logo to the left of the text.

I figured out how to resize the width correctly, but I'm having trouble with the position. The effect I'm trying to get is to have only the right side of the rectangle grow or shrink to fit the text. I have an expression on the rectangle's position, but I can't figure out why the rectangle scoots to the right as the text gets longer. (Screenshots attached)

Any suggestions? Thanks in advance!


t = thisComp.layer("Text").sourceRectAtTime();
t2 = thisComp.layer("Text 2").sourceRectAtTime();
logo = thisComp.layer("Logo").sourceRectAtTime();
w = Math.max(t.width, t2.width) + logo.width / 2;
h = t2.height / 2;
l = t2.left;
top =;

[w + l + logo.width, h + top];

Posts IndexRead Thread 

Current Message Thread:

© 2020 All Rights Reserved