Creative Communities of the World Forums

The peer to peer support community for media production professionals.

Activity Forums Adobe After Effects expression problem (moving objects in relation between other objects)

  • expression problem (moving objects in relation between other objects)

    Posted by Erin Shelby on May 15, 2006 at 4:29 am

    I have many objects (actually they are small 10×10 layers, but for ease of explaining the problem I’ll call them objects) and I currently have them in all in positions I like (as in, I visually like how they are setup now). Also, I have two “walls” (long 720×10 solids) at the bottom and top of the composition. Basically it looks like confetti with two long rectangles at the top and bottom of the composition.

    Now this is what I’d LIKE to do:

    I would like to make an expression so if the WALLS move in the Y axis the OBJECTS will proportionally stay between the walls (moving the walls close together would look like the comp is getting squished). I did this once with a very simple expression that took the Y axis of the top wall and the bottom wall and added them together and divided them by 2, and this was the Y position of the object. However, the problem this time is I already moved all the objects to places I like, so I need to figure out a way to keep the objects in relative position between the two walls now…

    Any pointers?

    Dan Ebberts replied 20 years ago 2 Members · 1 Reply
  • 1 Reply
  • Dan Ebberts

    May 15, 2006 at 2:56 pm

    One way: Duplicate your layer between the walls (just to mark its spot). Apply a slider and this position expression to the original:

    slider = effect(“Slider Control”)(“Slider”);
    topY = thisComp.layer(“top wall”).position[1];
    bottomY = thisComp.layer(“bottom wall”).position[1];
    y = linear(slider,0,100,topY,bottomY);
    [value[0],y]

    Use the slider to move the original layer back to the y position of the duplicate and delete the duplicate. The layer should now stay in relative position as you move the wall layers.

    Dan

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