ADOBE AFTER EFFECTS: Forum Expressions Tutorials Creative Cloud

# Movement based on another layers position and offset by layers index?

FAQ   •   VIEW ALL
 Movement based on another layers position and offset by layers index? on Jan 21, 2017 at 10:23:32 am

Hi expression magicians!
So.
What I'm trying to achieve is to move (or rotate) one layer and based on that movement, make a bunch of other layers move in the y axis in order based on their index.
Think of a line with little spheres and on top is a square moving from left to right and the spheres moves down when the square passes over, back to its origin after the square has passed.
Does this make sense? ☺

Any idea how such an expression would look like?

 Re: Movement based on another layers position and offset by layers index?on Jan 21, 2017 at 7:10:19 pm

Something like this maybe:

range = 150;
moveDist = 50;
d = length(thisComp.layer("square").transform.position,position);
yOffset = linear(d,0,range,moveDist,0);
value + [0,yOffset]

Dan

 Re: Movement based on another layers position and offset by layers index?on Jan 23, 2017 at 12:13:50 pm

Wow! Thank's so much Dan!