Creative Communities of the World Forums

The peer to peer support community for media production professionals.

Activity Forums Adobe After Effects Expressions maintaining stroke width of all elements, while scaling the MAIN COMP

  • maintaining stroke width of all elements, while scaling the MAIN COMP

    Posted by Tomer Katzir on September 24, 2020 at 4:15 pm

    Hey guys.

    I was wondering what is the best way to maintain the stroke width of all the elements inside a precomp, while scaling the precomp itself instead of a null inside it, that is linked to all the objects.

     

    thank you for helping out

    Stephen Dixon replied 5 years, 7 months ago 2 Members · 1 Reply
  • 1 Reply
  • Stephen Dixon

    September 25, 2020 at 1:29 am

    link the stroke width via expressions to the scale of the precomp in the outer comp.

    E.g. apply this to the stroke width:

    let s = comp(“outer comp name”).layer(thisComp.name).transform.scale;
    100/s[0] * value

    replace “outer comp name” with the name of the comp that contains the precomp. As the scale increases the stroke width will decrease, for example if the scale (represented by the variable s) is 200 then 100/s will equal 0.5, and conversely if the scale is 50 the 100/s = 2. Note that this will cause errors if the scale goes to zero, so you could add a try() to catch the error e.g., this will clamp it to 1000 × the current value

    let s = comp(“outer comp name”).layer(thisComp.name).transform.scale;
    try {
    Math.min(100/s[0], 1000) * value;
    } catch (err){
    1000 * value
    }

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