Jump to content


Photo

Controlling Shape Layer Elements via Expressions


  • Please log in to reply
8 replies to this topic

#1 mgrvsh

mgrvsh

    MoGraph Superstar

  • Members
  • 151 posts

Posted 28 April 2011 - 06:43 AM

Say I've got a bunch of circle shapes within a shape layer. How would I access their index (within the shape layer) in an expression? I basically want to setup an expression in the second circle shape that uses the shape layer equivalent of an 'index-1' so I can duplicate it a bunch of times and have a whole bunch of circles to control dynamically.

So, in case that wasn't clear enough, I want an expression in 'Shape Layer 1 > Contents > Circle 2 > Transform: Circle 2 > Scale' that dynamically references the scale of the Circle right above it in the stack (index-1).

I feel like I almost found the answer in the AE scripting guide by using a bunch of .property's but I couldn't make it work.

Any answers?

#2 mshadis

mshadis

    MoGraph Regular

  • Members
  • 79 posts
  • Gender:Male
  • Location:Los Angeles

Posted 28 April 2011 - 03:04 PM

I'd love to hear the answer to this too. But any chance in the meantime you could just use different layers for each circle? Maybe not quite as clean but would function just the same, especially if all the parameters you wanted to control were linked into a central null, then just hide the circle layers you don't want to see.

#3 Mylenium

Mylenium

    Eats, sleeps, drinks MoGraph

  • Members
  • 1,507 posts
  • Location:Leipzig, Germany
  • Interests:cycling, music, Sci-Fi

Posted 28 April 2011 - 03:49 PM

Shape layer content groups are property groups and can be adressed using the same syntax either using the reserved content().xyz stuff or the more generic propertyGroup() and propertyIndex() methods, meaning you can simply fill in 1 to 3 to go up in the hierarchy relative to the property to which the expression is applied and then use chained propertyIndex() stuff to walk down again from the root to where your referenced property is. However, since this kind of relative referencing is sensitive to changing the order of groups, it may be simpler (and safer) to indeed just use separate layers where possible....

Mylenium
[Pour Mylène, ange sur terre]
----------------------------------------------
www.myleniumblog.com

#4 mgrvsh

mgrvsh

    MoGraph Superstar

  • Members
  • 151 posts

Posted 28 April 2011 - 05:39 PM

it may be simpler (and safer) to indeed just use separate layers where possible....


Okay, thanks. I guess I'll just break them out to layers

#5 Todd Kopriva

Todd Kopriva

    Adobe Mastermind

  • Members
  • 786 posts
  • Gender:Male
  • Location:Seattle, WA, USA

Posted 30 April 2011 - 09:42 AM

Shape layer content groups are property groups and can be adressed using the same syntax either using the reserved content().xyz stuff or the more generic propertyGroup() and propertyIndex() methods, meaning you can simply fill in 1 to 3 to go up in the hierarchy relative to the property to which the expression is applied and then use chained propertyIndex() stuff to walk down again from the root to where your referenced property is.


Toward the bottom of this page, there are some instructions and an example for paint strokes, but the idea is the same.

---------------------------------------------------------------------------------------
Todd Kopriva, Adobe Systems Incorporated
After Effects product manager and curmudgeon
After Effects team blog
---------------------------------------------------------------------------------------


#6 mgrvsh

mgrvsh

    MoGraph Superstar

  • Members
  • 151 posts

Posted 30 April 2011 - 06:11 PM

Toward the bottom of this page, there are some instructions and an example for paint strokes, but the idea is the same.


Super helpful. Thank you.

#7 mgrvsh

mgrvsh

    MoGraph Superstar

  • Members
  • 151 posts

Posted 30 April 2011 - 06:11 PM

Toward the bottom of this page, there are some instructions and an example for paint strokes, but the idea is the same.


Super helpful. Thank you.

#8 JonAndesign

JonAndesign

    MoGraph Superstar

  • Members
  • 150 posts
  • Gender:Male
  • Location:Venice, Los Angeles
  • Interests:graphic design & animation

Posted 21 October 2011 - 06:46 PM

Something to add to this thread since it helped me out. Thanks guys :D


access a shape's index from any of its own properties:

thisProperty.propertyGroup(1).propertyIndex


#9 JonAndesign

JonAndesign

    MoGraph Superstar

  • Members
  • 150 posts
  • Gender:Male
  • Location:Venice, Los Angeles
  • Interests:graphic design & animation

Posted 21 October 2011 - 06:55 PM

figured I would also add...

access a shape layer's parent's index (and so on and so forth):

thisProperty.propertyGroup(2).propertyIndex





0 user(s) are reading this topic

0 members, 0 guests, 0 anonymous users