ADOBE AFTER EFFECTS: Forum Expressions Tutorials Creative Cloud

# Center and Animate text position

FAQ   •   VIEW ALL
 Center and Animate text position on Mar 17, 2019 at 7:18:16 pm

Hello, first of all, I want to thank those who contribute in this forum where I already had a lot of doubts about expressions in After Effects.

I've tried a lot of how to make animation based on expression in both the forum and the internet and I did not find a solution.

My question is this:

I have to relate the following animation expression to the position of another layer?

ease (time, inPoint + 0, inPoint + 1.5, [x, y], [x, y];

I want to make the position of the text start and end based on the position of a solid. Please see the image link to understand a little better.

https://media.giphy.com/media/1Qco37oaSMmAnb8koe/giphy.gif

I am already the expression below to centralize the text:
var w = thisComp.width;
var h = thisComp.height;
var w2 = w / 2;
var h2 = h / 2 +50;
[w2, h2]

When the expression of movement is working can you integrate the two?

Sorry for the poor translation.
Thanks for the help.

`ease (time, inPoint + 0, inPoint + 1.5, [x, y], [x, y];`

 Re: Center and Animate text positionon Mar 18, 2019 at 8:36:11 am

If you don't want to follow the solid this is how you do it.

x = thisComp.width/2;
ya = 0 - thisLayer.sourceRectAtTime().height - 50;
yb = thisComp.height/2;

ease (time, inPoint + 0, inPoint + 1.5,[x, ya], [x, yb]);

if you want to follow the solid. Just pick whip the position to the solids position and it will copy the movement.

But for both you need to centralise the anchor.

r = sourceRectAtTime();
[r.left + r.height/2, r.top + r.height/2];

 Re: Center and Animate text positionon Mar 18, 2019 at 2:33:42 pm

Dear Scott McGee thank you very much for the tip, for some time I was looking for a solution to this animation.

But I forgot to mention something important the solid is linked to the text by the expression:
parent.sourceRectAtTime (). top -1098

So when I implement your suggestion does not work because the solid moves along with the text as in the example below:

https://giphy.com/gifs/6qq0BQAQBklFTPDMVC/html5

What I want from this animation is for the solid to align to the top of the text when typing any number of lines and then it is fixed so that I can animate position of the text as I did in the example below using keyframes and without any expression.

https://giphy.com/gifs/XJzx1kWwJkoddJXQKJ/html5

Thanks for all the effort and help!

 Re: Center and Animate text positionon Mar 20, 2019 at 9:19:15 am

I've just recreated what you've done in your second video example by doing this.

anchorPoint
r = sourceRectAtTime();
[r.left + r.width/2, r.top + r.height/2];

Position
x = thisComp.width/2;
ya = 0 - thisLayer.sourceRectAtTime().height - 50;
yb = 0 + thisComp.layer("Shape Layer 1").sourceRectAtTime().height + thisLayer.sourceRectAtTime().height/2 + 30;

ease (time, inPoint + 0, inPoint + 1.5,[x, ya], [x, yb]);

The position looks at the height of the shape layer + the height of your text/2 + a little padding. This proportions itself accordingly.

It might need tweaking, but it looks the same as your 2nd video example.