Activity › Forums › Adobe After Effects Expressions › Accessing siblings in the same Shape Group
-
Accessing siblings in the same Shape Group
Posted by Ryan Paterson on July 18, 2013 at 5:33 pmI’m trying to animate each element in a Shape group based on the animation of the first one, So my structure looks like:
Parent-> Sibling
Sibling
SiblingPretty simple, and I know it has something to do with “propertyIndex()” but I just can’t quite wrap my head around how to properly use it yet, and as usual the expression reference provides no help outside of the one example they list, perhaps someone can help me with this!
Dan Ebberts replied 8 years, 5 months ago 3 Members · 11 Replies -
11 Replies
-
Dan Ebberts
July 18, 2013 at 6:24 pmYou need to use propertyGroup() to navigate the hierarchy. propertyGroup(1) takes you up one level, propertyGroup(2) up two levels, etc.
What I always end up doing is using a text layer to show me what’s going on. Use the pickwhip to create a source text expression connected to the shape property you’re interested in:
prop = {use pickwhip};
prop.propertyGroup(1).nameYou should be able to investigate the whole hierarchy that way.
Dan
-
Ryan Paterson
July 18, 2013 at 10:45 pmThat is a nice little trick, so how would I go about navigating a hierarchy. For instance if I wanted Sibling 1 to take Sibling 2’s Opacity? Oviously you could just pickwhip it, but if I wanted it to be dynamic? Is that possible or do I have to explicitly name the group I’d like to use?
-
Dan Ebberts
July 18, 2013 at 11:01 pmSomething like this should give you the opacity of the top shape in the stack:
thisProperty.propertyGroup(3)(1)(“Transform”)(“Opacity”)
Dan
-
Ryan Paterson
July 18, 2013 at 11:05 pmYes! That’s exactly what I was looking for- can I ask you this though, how would one go about finding out about that 2nd set of brackets?? I’m looking at the Expression Reference right now and there’s not even a hint of it anywhere. Is there a doc somewhere that lists all the properties and methods for AE expressions?
-
Dan Ebberts
July 18, 2013 at 11:12 pmpropertyGroup(3) takes you from the opacity property up to the “Contents” level and then (1) takes you down to the first property below that, which in my case was “Ellipse 3”. I could have used that name instead, but (1) is more generic–it should work for any shape type.
Dan
-
Ryan Paterson
July 18, 2013 at 11:17 pmNo I get how it works, I’m just wondering how to find out about that without having to resort to posting on here. I’m just asking if there’s a more in-depth resource than the AE Expression Reference which I often find to be lacking information.
And also when I used that code I got the all-too familiar “Layer level Property Groups dont have enclosing groups”, not sure why
-
Ryan Paterson
July 18, 2013 at 11:49 pmnevermind I fixed that error message, didn’t realize I had to specify the layer before going into the propertyGroup.
Would still love to know about a proper reference of all expression functions though 🙂
-
Dan Ebberts
July 18, 2013 at 11:56 pmI’m not aware of a reference like that. I built my own using the text layer technique I described, but I don’t use it any more.
I’m not sure why you would get that error message unless you apply that code to a property that’s at a higher level in the hierarchy.
Dan
-
Ryan Paterson
July 19, 2013 at 12:47 amJust for posterity, in case anyone else happens upon this thread, I found a way to make the contents truly dynamic, in that you can duplicate this expression and it will continue to work-
prop = thisProperty; //Current Property (obviously)
ind = prop.propertyGroup(2); //Gets the container of the property (adjust to hierarchy)prop.propertyGroup(3)(ind.propertyIndex + 1).transform.opacity.valueAtTime(time – .5)
//Goes all the way up in the hierarchy, then back down to one group below the current one and extracts whatever value you need, offset in time
Thanks for pointing me in the right direction Dan! I’ll be back before long 😉
-
Dean Mellis
December 14, 2017 at 5:47 pmDan, Do you know if Adobe ever plans to make this kind of functionality more reasonable. I’m no expression master but I’m no novice either and I’ve come back here so many times looking to comprehend this to no avail. I’m convinced it’s the weakest part of the After Effects universe. Nevertheless, thanks for the help along the way.
Reply to this Discussion! Login or Sign Up