FORUMS: list search recent posts

# Z-rotation linked to two points - one is 3D and the other 2D

FAQ   •   VIEW ALL
 Z-rotation linked to two points - one is 3D and the other 2D on Aug 1, 2011 at 5:25:59 am

Hi peeps, I'm looking for an Expression to link the Z-rotation property of a layer from two points residing in two separate layers - one is 3D layer and the other is 2D.

TIA
RoRK

Intensive AE & Mocha Training in Asia.

 Re: Z-rotation linked to two points - one is 3D and the other 2Don Aug 1, 2011 at 1:20:28 pm

Are you talking about something like this?

``` L1 = thisComp.layer("2D Layer"); p1 = L1.toComp(L1.anchorPoint); L2 = thisComp.layer("3D Layer"); p2 = L2.toComp(L2.anchorPoint); v = p2 - p1; radiansToDegrees(Math.atan2(v[1],v[0])) ```

Dan

 Re: Z-rotation linked to two points - one is 3D and the other 2Don Aug 1, 2011 at 2:04:19 pm

That works well Dan BUT I've found another issue. Here's the scenario -

I have the Beam effect linking the two points mentioned. I would like to place a Text Layer along the Beam; centered will be fine but it'll be better if I am able to move the text anywhere along the Beam.

Right now, the Z-rotation for the text layer looks good but there are instances where the text strays away from the Beam.

Cheers
RoRK

Intensive AE & Mocha Training in Asia.

 Re: Z-rotation linked to two points - one is 3D and the other 2Don Aug 1, 2011 at 6:48:14 pm

This should position the text anchor point at the center of the beam:

L1 = thisComp.layer("2D Layer");
p1 = L1.toComp(L1.anchorPoint);
L2 = thisComp.layer("3D Layer");
p2 = L2.toComp(L2.anchorPoint);
(p1 + p2)/2

You could add a Position animator tied to sliders to adjust the x and y, if necessary.

Dan

 Re: Z-rotation linked to two points - one is 3D and the other 2Don Aug 2, 2011 at 4:40:11 am

Awesome! How can I convert my 2D Beam layer (Solid) to a 3D layer (cos I'd like some 3D shadows) and keep everything sexy?

TIA
RoRK

Intensive AE & Mocha Training in Asia.