"this" syntax for paint strokes?

Moderators: Disciple, zlovatt

Post Reply
byronnash
Posts: 321
Joined: July 7th, 2004, 2:30 pm
Location: Charlotte, NC
Contact:

I have a simple expression linking the clone position of a paint stroke to the transform of the paint stroke. Right now I have it set as

Code: Select all

p=effect("Paint").stroke("LL").transform.position;
but I would like to have something more like

Code: Select all

p=this.transform.position;
When I use the second line it takes the position of the layer not the stroke. Is there a way to use "this" so I can avoid having to hard code the stroke name in the expression? I have to dupe this stroke lots of times and it would save me some time.
Paul Tuersley
Posts: 704
Joined: June 5th, 2004, 7:59 am
Location: London, UK

Try this:

Code: Select all

propertyGroup(2).transform.position;
byronnash
Posts: 321
Joined: July 7th, 2004, 2:30 pm
Location: Charlotte, NC
Contact:

Thanks, that worked. Why Property Group 2? Is there an explanation of that in the docs?
Paul Tuersley
Posts: 704
Joined: June 5th, 2004, 7:59 am
Location: London, UK

Yes, it's in the "After Effects expression elements reference" section under "Property attributes and methods". Or just do a search for "propertyGroup". I'm surprised you couldn't find it. ;)

You're basically moving twice back up the propertyGroup heirachy. You start at Clone Position, back up once to Stroke Options, then again to this clone stroke's main group (Clone 1 or whatever), and from there you go forward through to Transform > Position.

To check I was doing it right, I linked the property to a text layer and used this expression on the Source Text property:

Code: Select all

a = thisComp.layer("Black Solid").effect("Paint").stroke("Clone 1").strokeOption.clonePosition;
a.propertyGroup(2).name;
Paul
byronnash
Posts: 321
Joined: July 7th, 2004, 2:30 pm
Location: Charlotte, NC
Contact:

Thanks for the explanation. I've glossed over it before but it's one of those topics I have a hard time getting my head around for some reason.
Post Reply