Creative Communities of the World Forums

The peer to peer support community for media production professionals.

Activity Forums Adobe After Effects Expressions Linking a Shape Layer’s Size (X) to the Position of a Null Object (X)

  • Linking a Shape Layer’s Size (X) to the Position of a Null Object (X)

    Posted by Gabe Hobbs on August 30, 2018 at 8:18 pm

    Okay so I’m definitely new to expressions other than finding what I need through relentless internet searching. But I can’t seem to find what I’m trying to do here.

    So I have a rectangle layer’s x size that I want to connect to a null objects position in x. So when the rectangle gets bigger in X the null object will move to the left on the X axis.

    Thanks!

    Scott Mcgee replied 8 years ago 2 Members · 1 Reply
  • 1 Reply
  • Scott Mcgee

    August 31, 2018 at 7:32 am

    Just because I might have missed read this.

    If you want, when the shape width gets bigger and extends to the left. You need your anchor point to be situated to the right hand side.

    So in anchor point of your layer.

    r = sourceRectAtTime();
    [r.left + r.width, r.top + r.height/2]

    then pick whip the position to the null.

    Alternatively, if you want the position to move rather than the shape extending.

    I’d still use the anchor point expression as the anchor won’t sit still when it changes.

    Then in the position. I don’t know how much you want to move it by, which makes me think you want the 1st option.

    x = thisComp.layer(“Null 1”).transform.position[0] – content(“Rectangle 1”).content(“Rectangle Path 1”).size[0];
    y = value[1];
    [x,y]

    If you want it to start on the anchor point of the null, then you have to make some alterations.

    Hope that helps

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