Creative Communities of the World Forums

The peer to peer support community for media production professionals.

Activity Forums Adobe After Effects Expressions Stroke width and nulls

  • Stroke width and nulls

    Posted by Julie Mullins on September 28, 2017 at 9:57 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;

    Ryan Bechtel replied 8 years, 6 months ago 3 Members · 5 Replies
  • 5 Replies
  • Dan Ebberts

    September 28, 2017 at 10:36 pm

    Try it this way:

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

    Dan

  • Julie Mullins

    September 29, 2017 at 12:36 am

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

  • Ryan Bechtel

    October 20, 2017 at 7:22 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?

  • Dan Ebberts

    October 20, 2017 at 7:45 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

  • Ryan Bechtel

    October 20, 2017 at 8:00 pm

    This works, amazing! Thank you so much!!

We use anonymous cookies to give you the best experience we can.
Our Privacy policy | GDPR Policy