Creative Communities of the World Forums

The peer to peer support community for media production professionals.

Activity Forums Adobe After Effects Expressions Null control with different speeds on X and Y

  • Null control with different speeds on X and Y

    Posted by Kari Pieskä on July 4, 2013 at 8:19 am

    I want to control an object with a null so, that the object would move at different speeds on X and Y. I thought this would be fairly simple with the techniques I’ve learned.
    I thought I separate the x and y and just give them a different multiply. But it didn’t work.

    What am I doing wrong?

    x=thisComp.layer("Null").transform.position[0]
    y=thisComp.layer("Null").transform.position[1]
    transform.position[0]+x*1.5
    transform.position[1]+y*1.8

    Kari Pieskä replied 13 years ago 2 Members · 4 Replies
  • 4 Replies
  • Dan Ebberts

    July 4, 2013 at 3:29 pm

    I think this is what you’re trying to do:

    x=thisComp.layer(“Null”).transform.position[0];
    y=thisComp.layer(“Null”).transform.position[1];
    value + [x*1.5,y*1.8]

    Dan

  • Kari Pieskä

    July 5, 2013 at 7:53 am

    Great, it works!

    Just one basic question: why didn’t my version work? It seems to be trying to do the same thing.
    Is it because I have to wrap, or calculate the code in one “sentence” or line?

    so when I have my version:
    transform.position[0]+x*1.5
    transform.position[1]+y*1.8

    It doesn’t work, because they are not calculated at the same time? Does everything have to be inside one equation?
    Like in your version?

  • Dan Ebberts

    July 5, 2013 at 5:11 pm

    The result needs to be a two-element array for a two-dimensional property. This would have worked:

    [transform.position[0]+x*1.5,transform.position[1]+y*1.8]

    Dan

  • Kari Pieskä

    July 5, 2013 at 6:09 pm

    Aha, ok, seems familiar. Two element array and a comma dividing the elements. In your version you just gathered the two dimensions into “value” and + (x,y) with the multiplys are the two elements.

    I know I got it, just have to digest it a bit.
    Thank you Dan, you’re very helpful.

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