Creative Communities of the World Forums

The peer to peer support community for media production professionals.

Activity Forums Adobe After Effects Expressions link skew and position in a shape layer

  • link skew and position in a shape layer

    Posted by Steve Sierra on August 7, 2018 at 2:15 pm

    Hello everyone,

    I am trying to link skew and position between two rectangle paths in a shape layer. I would like for the second one to skew as it moves on the X axis in order for it’s top right corner meets the top right corner of the first rectangle (making half of a rooftop).
    I am trying to use Math.atan, but it only gives me small numbers between 1 and 1.5 more or less…
    My rectangles both start at pos [0, 0] and the anchor points are at their center, so I divided the height by two.
    Any help would be appreciated !
    Thanks ????

    Here’s my expression for the skew property :

    a = content(“Rectangle 1”).content(“Rectangle Path 1”).size[1]/2;
    b = content(“Rectangle 2”).content(“Rectangle Path 1”).position[0];
    Math.atan(a/b)

    Kalleheikki Kannisto replied 7 years, 9 months ago 2 Members · 5 Replies
  • 5 Replies
  • Kalleheikki Kannisto

    August 7, 2018 at 2:35 pm

    Despite several attempts to understand the objective I fail to do so. Can you do a manual mockup of what you want to happen when one of the shapes moves, two different positions?

    Kalleheikki Kannisto
    Senior Graphic Designer

  • Steve Sierra

    August 7, 2018 at 3:04 pm

    Hi,

    Sorry if I wasn’t clear enough… Here are some pics to better explain. The first one is what I want, the other is what I get !

    Thanks !

  • Kalleheikki Kannisto

    August 8, 2018 at 7:01 am

    You weren’t that far off. The main issue is that javascript uses radians instead of degrees, so you have to convert them to degrees (this is why you were getting figures in such a low range). Then switch a/b to b/a and reverse the slant angle with a minus and you’ll be all set:

    a = content("Rectangle 1").content("Rectangle Path 1").size[1]/2;
    b = content("Rectangle 2").content("Rectangle Path 1").position[0];
    s = -radiansToDegrees(Math.atan(b/a))

    Kalleheikki Kannisto
    Senior Graphic Designer

  • Steve Sierra

    August 8, 2018 at 9:38 am

    Hi Kalleheikki,

    Thank you very much ! This works perfectly .
    I had just found a workaround : I just offset the rectangle 2 Anchor point to its top/center. I then just have to change the skew amount ????

    Thanks again for your time.
    Best regards,

    S.

  • Kalleheikki Kannisto

    August 8, 2018 at 5:11 pm

    Ok, great. Anchor points are handy that way.

    Kalleheikki Kannisto
    Senior Graphic Designer

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