FORUMS: list search recent posts

Expression References Content Item to Which it Is Applied?

COW Forums : Adobe After Effects Expressions

<< PREVIOUS   •   FAQ   •   VIEW ALL   •   PRINT   •   NEXT >>
Demian Krentz
Expression References Content Item to Which it Is Applied?
on Jan 19, 2017 at 4:52:39 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.


Return to posts index

Dan Ebberts
Re: Expression References Content Item to Which it Is Applied?
on Jan 19, 2017 at 6:00:25 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



Return to posts index

Demian Krentz
Re: Expression References Content Item to Which it Is Applied?
on Jan 26, 2017 at 8:45:39 pm

Lifesaver as always, Dan. Thanks.


Return to posts index

<< PREVIOUS   •   VIEW ALL   •   PRINT   •   NEXT >>
© 2017 CreativeCOW.net All Rights Reserved
[TOP]