Creative Communities of the World Forums

The peer to peer support community for media production professionals.

Activity Forums Adobe After Effects Expressions limit motion in one axis at a time

  • limit motion in one axis at a time

    Posted by Magali Zadoff on June 17, 2016 at 5:46 pm

    Hello,
    Please can anybody help me with this:
    I need to create an expression to limit the motion of many many layers, that are already keyframed, to move only in one axis at a time.
    The motion now is in diagonal, but I want the layers to move in X direction first and in Y direction after the X movement is complete (or in the other order, it is the same for me).
    That, for each movement between 2 keyframes, and then again for the next 2 keys, and so on.
    They are too many layers so I can’t do separate dimensions, offset keyframes…etc. for each one.
    So I think an expression would be good for this.
    Thank you in advance!

    Joe Clay replied 9 years, 11 months ago 2 Members · 5 Replies
  • 5 Replies
  • Joe Clay

    June 22, 2016 at 9:33 pm

    OK, this is a very specific solution, meaning that if your keys aren’t set up in a specific way, this won’t work. It would’ve been a lot easier if you had thought about that motion first. Anyway, this assumes your keys are 20 frames apart. As long as your keys are all the same, this will work. There’s an aep here if you want to see how my test was set up.

    Basically it delays the y movement by the amount of frames specified after the frameDuration part below. So in my example project, the move is 20 frames. The first 20 frames the layer moves on x, and then the y movement starts immediately after. If all of your keys are different, maybe you can find a certain amount of frames to delay that will get your desired effect. If your keys are all a certain number of frames apart, just put that number in for 20 below and you’ll be all set.

    Add the expression to the position property, obviously.

    y = valueAtTime(time-thisComp.frameDuration*20)[1];
    [value[0],y];

    Joe Clay
    Workbench.tv

  • Joe Clay

    June 22, 2016 at 9:35 pm

    OK, this is a very specific solution, meaning that if your keys aren’t set up in a specific way, this won’t work. It would’ve been a lot easier if you had thought about that motion first. Anyway, this assumes your keys are 20 frames apart. As long as your keys are all the same, this will work. There’s an aep here if you want to see how my test was set up.

    Basically it delays the y movement by the amount of frames specified after the frameDuration part below. So in my example project, the move is 20 frames. The first 20 frames the layer moves on x, and then the y movement starts immediately after. If all of your keys are different, maybe you can find a certain amount of frames to delay that will get your desired effect. If your keys are all a certain number of frames apart, just put that number in for 20 below and you’ll be all set.

    Joe Clay
    Workbench.tv

  • Joe Clay

    June 22, 2016 at 9:36 pm

    I don’t know why that came in twice, but the link to the aep was broken on the first one.

    Joe Clay
    Workbench.tv

  • Magali Zadoff

    June 22, 2016 at 9:46 pm

    Thank you very much Joe!! that expression works great for me!
    Thank you again!

  • Joe Clay

    June 23, 2016 at 5:04 am

    Awesome! You’re welcome. I’m glad I was able to help out!

    Joe Clay
    Workbench.tv

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