ADOBE AFTER EFFECTS: Forum Expressions Tutorials Creative Cloud

link a layers Y position to another layers y scale

COW Forums : Adobe After Effects Expressions

<< PREVIOUS   •   FAQ   •   VIEW ALL   •   PRINT   •   NEXT >>
Conor McLaughlin
link a layers Y position to another layers y scale
on Nov 9, 2018 at 2:41:47 pm

I'm trying to link a layers Y position to another layers y scale. Is their an expression I can use?

Here is my project: https://imgur.com/a/fbjc08o

As the pink walls scale up, I want the green cube top to follow.

Thanks


Return to posts index

Scott McGee
Re: link a layers Y position to another layers y scale
on Nov 12, 2018 at 12:41:16 pm

If you want the green top layer to move on the y position.

Someone might have a better expression to link something to the edge. But this is the idea you want.

x = value[0]
y = thisComp.layer(index+1).position[1] - thisComp.layer(index+1).sourceRectAtTime().height;
[x,y]


Making sure you anchorPoint is attached the bottom of the pink layer the is scaling up. This will position it to the top part of the shapeLayer.

If you are using the scale[1]. You'll need it to calculate the percentage

x = value[0]
y = thisComp.layer(index+1).position[1] - (thisComp.layer(index+1).sourceRectAtTime().height * thisComp.layer(index+1).scale[1]/100);
[x,y]


I'm sure someone else will have a tidier expression that works better, but this should do the trick for you if your anchorPoints are set up correctly

Hope that helps.


Return to posts index

Conor McLaughlin
Re: link a layers Y position to another layers y scale
on Nov 14, 2018 at 12:46:25 pm

Thanks!


Return to posts index

<< PREVIOUS   •   VIEW ALL   •   PRINT   •   NEXT >>
© 2018 CreativeCOW.net All Rights Reserved
[TOP]