ADOBE AFTER EFFECTS: Forum Expressions Tutorials Creative Cloud

Stroke width and nulls

COW Forums : Adobe After Effects Expressions

<< PREVIOUS   •   FAQ   •   VIEW ALL   •   PRINT   •   NEXT >>
Julie Mullins
Stroke width and nulls
on Sep 28, 2017 at 9:57:56 pm

Hi,

I'm having a problem with keeping a uniform stroke width on shapes using the expression below, I think it has something to do with the parented nulls.
I also tried just putting the shape path in an empty Group, moving the stroke below the group, and parenting the stroke of the shape. It works when I create a new comp and create new shapes, but not with the shape layers I already have in my main comp.

I've used the expression on the shapes in the yellow scene and on the window outlines in the blue scene, but not on the character in the blue scene. The window is all out of whack, and when the null scales down the lines in the orange scene they seem to go below 4px.

Any ideas? Here is my file:

11726_stroketest.aep.zip

s = transform.scale[0]; 
scaleFactor = 100/s;
value*scaleFactor;


Return to posts index

Dan Ebberts
Re: Stroke width and nulls
on Sep 28, 2017 at 10:36:48 pm

Try it this way:

s = transform.scale[0];
if (hasParent) s *= parent.transform.scale[0]/100; 
scaleFactor = 100/s;
value*scaleFactor;


Dan



Return to posts index

Julie Mullins
Re: Stroke width and nulls
on Sep 29, 2017 at 12:36:38 am

YES!!!! You did it! Thank you!!


Return to posts index


Ryan Bechtel
Re: Stroke width and nulls
on Oct 20, 2017 at 7:22:47 pm

This works well for me but I'm having an issue when the Null is parented to another Null. It doesn't work when that happens

Is there some workaround for that?


Return to posts index

Dan Ebberts
Re: Stroke width and nulls
on Oct 20, 2017 at 7:45:03 pm

Try this one:


L = thisLayer;
s = transform.scale.value;
while (L.hasParent){
L = L.parent;
for (i = 0; i < s.length; i++) s[i] *= 100/L.transform.scale.value[i]
}
s



Dan



Return to posts index

Ryan Bechtel
Re: Stroke width and nulls
on Oct 20, 2017 at 8:00:08 pm

This works, amazing! Thank you so much!!


Return to posts index

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