Creative Communities of the World Forums

The peer to peer support community for media production professionals.

Activity Forums Adobe After Effects Expressions Turning Pages with Different sides in AE

  • Turning Pages with Different sides in AE

    Posted by Josh Kurz on June 26, 2009 at 8:06 pm

    I have a comp with a camera and 3D layers simulating pages in a book. Since the page has two sides, I’m using two layers for each page. When I put both layers really close to each other, AE gives me a bunch of glitches (especially with a moving camera and motion blur). So that doesn’t work.

    I’m trying to write an expression that controls the opacity of a layer depending on whether it’s facing the camera. I’d like it to do this calculation no matter where I move or rotate the camera and/or the layer.

    I tried an expression that calculates the angle between where the layer is facing and where the camera is facing to give me a value that I could use to manipulate opacity but there are situations where this doesn’t work like when the layer is rotated and moved to one side.

    I’m thinking I need to calculate the worldspace angle of a vector from the coordinates of the camera to the anchor point of the layer and then use the vector I originally created from the layer to come up with the angle of view that will determine my opacity.

    So I guess my question are:
    1. Is there an easier way to do this?
    2. If not, what expression would calculate the worldspace angle off the z axis of the vector from the position of the camera to the anchor point of a layer?

    Here’s my original code gave me an angle value that didn’t quite work.:
    L=thisLayer;
    cam=thisComp.layer(“Camera 1”);
    u=L.toWorldVec([0,0,1]);
    c=cam.toWorldVec([0,0,1]);
    A=radiansToDegrees(Math.atan2(u[0],u[2]));
    B=radiansToDegrees(Math.atan2(c[0],c[2]));
    A-B

    I hope this isn’t too confusing. Thanks for all your help in advance.

    Josh Kurz replied 16 years, 10 months ago 2 Members · 2 Replies
  • 2 Replies

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