Creative Communities of the World Forums

The peer to peer support community for media production professionals.

Activity Forums Adobe After Effects Expressions Expression References Content Item to Which it Is Applied?

  • Expression References Content Item to Which it Is Applied?

    Posted by Demian Krentz on January 19, 2017 at 4:52 pm

    I have a number of content rectangles contained in a shape layer. I’m getting the position of each (for reasons) and storing it in X.

    X = content("Rectangle 1").transform.position[0];

    Rather than manually change the “Rectangle 1” string for each of the several dozen rectangles, I’d like that section of the expression to explicitly know we’re talking about the position of the content rectangle to which the expression is applied, not the shape layer containing it. Is this possible?

    I’ve tried changing the code to the following:

    X = this.transform.position[0];

    I’m currently unsure if that’s getting the position of the shape layer or the rectangle.

    Any help is greatly appreciated.

    Demian Krentz replied 9 years, 7 months ago 2 Members · 2 Replies
  • 2 Replies
  • Dan Ebberts

    January 19, 2017 at 6:00 pm

    It depends on which property is hosting the expression, but basically you use propertyGroup() to navigate up the hierarchy as far as you need to. For example, say you wanted the rectangle’s rotation to match its x position. You could do it like this:

    thisProperty.propertyGroup(1).position[0]

    or like this:

    thisProperty.propertyGroup(2).transform.position[0]

    Dan

  • Demian Krentz

    January 26, 2017 at 8:45 pm

    Lifesaver as always, Dan. Thanks.

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