Creative Communities of the World Forums

The peer to peer support community for media production professionals.

Activity Forums Adobe After Effects Expressions Z-rotation linked to two points – one is 3D and the other 2D

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

    Posted by Roland R. kahlenberg on August 1, 2011 at 5:25 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.

    Roland R. kahlenberg replied 15 years, 1 month ago 2 Members · 4 Replies
  • 4 Replies
  • Dan Ebberts

    August 1, 2011 at 1:20 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

  • Roland R. kahlenberg

    August 1, 2011 at 2:04 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.

  • Dan Ebberts

    August 1, 2011 at 6:48 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

  • Roland R. kahlenberg

    August 2, 2011 at 4:40 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.

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