ADOBE AFTER EFFECTS: Forum Expressions Tutorials Creative Cloud

Accessing siblings in the same Shape Group

COW Forums : Adobe After Effects Expressions

<< PREVIOUS   •   FAQ   •   VIEW ALL   •   PRINT   •   NEXT >>
Ryan Paterson
Accessing siblings in the same Shape Group
on Jul 18, 2013 at 5:33:24 pm

I'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
Sibling

Pretty 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!


Return to posts index

Dan Ebberts
Re: Accessing siblings in the same Shape Group
on Jul 18, 2013 at 6:24:21 pm

You 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).name

You should be able to investigate the whole hierarchy that way.

Dan



Return to posts index

Ryan Paterson
Re: Accessing siblings in the same Shape Group
on Jul 18, 2013 at 10:45:14 pm

That 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?


Return to posts index


Dan Ebberts
Re: Accessing siblings in the same Shape Group
on Jul 18, 2013 at 11:01:38 pm

Something like this should give you the opacity of the top shape in the stack:

thisProperty.propertyGroup(3)(1)("Transform")("Opacity")


Dan



Return to posts index

Ryan Paterson
Re: Accessing siblings in the same Shape Group
on Jul 18, 2013 at 11:05:35 pm

Yes! 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?


Return to posts index

Dan Ebberts
Re: Accessing siblings in the same Shape Group
on Jul 18, 2013 at 11:12:19 pm

propertyGroup(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



Return to posts index


Ryan Paterson
Re: Accessing siblings in the same Shape Group
on Jul 18, 2013 at 11:17:46 pm

No 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


Return to posts index

Ryan Paterson
Re: Accessing siblings in the same Shape Group
on Jul 18, 2013 at 11:49:52 pm

nevermind 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 :)


Return to posts index

Dan Ebberts
Re: Accessing siblings in the same Shape Group
on Jul 18, 2013 at 11:56:17 pm

I'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



Return to posts index


Ryan Paterson
Re: Accessing siblings in the same Shape Group
on Jul 19, 2013 at 12:47:12 am

Just 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 ;)


Return to posts index

Dean Mellis
Re: Accessing siblings in the same Shape Group
on Dec 14, 2017 at 5:47:53 pm

Dan, 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.


Return to posts index

Dan Ebberts
Re: Accessing siblings in the same Shape Group
on Dec 14, 2017 at 6:47:40 pm

I'm not aware of any changes in the works. I doubt that there's much demand for it though.

Dan



Return to posts index

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