Creative Communities of the World Forums

The peer to peer support community for media production professionals.

Activity Forums Adobe After Effects Expressions How to get layers position relative to another (rotated) layer.

  • How to get layers position relative to another (rotated) layer.

    Posted by Toms Burāns on September 5, 2019 at 12:28 pm

    I need a layer in a nested composition to follow (exactly match) a null in the parent comp.
    The nested composition is smaller (but not scaled) and rotated in the parent comp.
    Both the null and nested comp are parented to other layers.

    I can find the position of the null relative to the nested comp by getting the difference of their absolute positions but that only works correctly if the nested comp is not rotated.

    Any help greatly appreciated!
    Thanks!

    p1 = comp("parent").layer("null");
    p2 = comp("nested").layer("layer");
    p1W = p1.toWorld(p1.anchorPoint);
    p2W = p2.toWorld(p2.anchorPoint);
    p1W - p2W

    Toms Burāns replied 6 years, 8 months ago 2 Members · 2 Replies
  • 2 Replies
  • Dan Ebberts

    September 5, 2019 at 1:23 pm

    I think it will be like this:

    L1 = comp(“parent”).layer(“null”);
    p1 = L1.toWorld(L1.anchorPoint);
    L2 = comp(“parent”).layer(“nested”);
    L2.fromWorld(p1)

    Dan

  • Toms Burāns

    September 5, 2019 at 1:30 pm

    Excellent. Thank you very much!

    Toms

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