Creative Communities of the World Forums

The peer to peer support community for media production professionals.

Activity Forums Adobe After Effects Expressions Possible expression to move Z axis on one layer when Y axis moves on another layer?

  • Possible expression to move Z axis on one layer when Y axis moves on another layer?

    Posted by Matthew Ruiz on August 13, 2015 at 12:18 am

    Hopefully this question makes sense I feel confident this possible but I am unsure on how to do so.

    In a 3D project when the Y axis moves I want the Z axis on another layer to move coherent with the Y axis.

    Hope that makes sense,

    Matt

    Matthew Ruiz replied 11 years ago 2 Members · 6 Replies
  • 6 Replies
  • Dan Ebberts

    August 13, 2015 at 1:52 am

    There are a couple of ways to interpret what you’re asking for. The most common requires a reference–either a hard-coded value for y, or, as in this example, where the layer was at time zero.

    p = thisComp.layer(“other layer”).transform.position;
    y = p.value[1] – p.valueAtTime(0)[1];
    value + [0,0,y]

    Note that nothing will happen until you animate the y-motion layer, then the layer with the expression should match the movement in z.

    Dan

  • Matthew Ruiz

    August 13, 2015 at 3:42 am

    I think I am doing something wrong but not sure where the layer “front control” is my Y axis layer I am putting the expression on the Z axis layer “bottom control” I plug in the expression below in the Z axis layer but the “bottom control” (aka Z axis layer) does not move with it am I missing a bit of information into the expression?

    Thanks,

    Matt

    p = thisComp.layer("Front controls").transform.position
    y = thisComp.layer("Front controls").transform.position[1] - p.valueAtTime(0)[1];
    value + [0,0,y]

  • Dan Ebberts

    August 13, 2015 at 3:47 am

    You have to animate “front control” (with keyframes or an expression), or nothing will happen.

    Dan

  • Matthew Ruiz

    August 13, 2015 at 4:40 am

    I’m sorry I completely asked the wrong question, (long day) your expression worked flawlessly thank you. I meant to ask if I wanted to do the same exact effect except I want the Z axis to go opposite direction how would I do that in the expressions if possible?

    Thanks,

    Matt

  • Dan Ebberts

    August 13, 2015 at 4:52 am

    Just change the last line to:

    value – [0,0,y]

    Dan

  • Matthew Ruiz

    August 13, 2015 at 5:24 am

    Kudos sir, Dan! Much appreciated!

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