Creative Communities of the World Forums

The peer to peer support community for media production professionals.

Activity › Forums › Adobe After Effects Expressions › Movement based on another layers position and offset by layers index?

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

    Posted by Göran Thorén on January 21, 2017 at 10:23 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?

    /Thank’s in advance!

    Göran Thorén replied 9 years, 8 months ago 2 Members · 2 Replies
  • 2 Replies
  • Dan Ebberts

    January 21, 2017 at 7:10 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

  • Göran Thorén

    January 23, 2017 at 12:13 pm

    Wow! Thank’s so much Dan!
    Didn’t get a notification about this so sorry for not thanking you earlier.

    It works like a charm. Now I’m going to try to understand the expression. ☺
    Thank’s again!
    /Göran

We use anonymous cookies to give you the best experience we can.
Our Privacy policy | GDPR Policy