Page 1 of 1

"this" syntax for paint strokes?

Posted: August 21st, 2008, 11:42 am
by byronnash
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.

Re: "this" syntax for paint strokes?

Posted: August 21st, 2008, 3:48 pm
by Paul Tuersley
Try this:

Code: Select all

propertyGroup(2).transform.position;

Re: "this" syntax for paint strokes?

Posted: August 22nd, 2008, 8:22 am
by byronnash
Thanks, that worked. Why Property Group 2? Is there an explanation of that in the docs?

Re: "this" syntax for paint strokes?

Posted: August 22nd, 2008, 9:03 am
by Paul Tuersley
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

Re: "this" syntax for paint strokes?

Posted: August 22nd, 2008, 9:06 am
by byronnash
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.