ADOBE AFTER EFFECTS: Forum Expressions Tutorials Creative Cloud

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

COW Forums : Adobe After Effects Expressions

<< PREVIOUS   •   FAQ   •   VIEW ALL   •   PRINT   •   NEXT >>
Toms Burāns
How to get layers position relative to another (rotated) layer.
on Sep 5, 2019 at 12:28:02 pm
Last Edited By Toms Burāns on Sep 5, 2019 at 12:31:30 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


Return to posts index

Dan Ebberts
Re: How to get layers position relative to another (rotated) layer.
on Sep 5, 2019 at 1:23:03 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



Return to posts index

Toms Burāns
Re: How to get layers position relative to another (rotated) layer.
on Sep 5, 2019 at 1:30:46 pm

Excellent. Thank you very much!

Toms


Return to posts index

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