Creative Communities of the World Forums

The peer to peer support community for media production professionals.

Activity Forums Adobe After Effects Expressions Null rotation driving/affecting multiple opacities

  • Null rotation driving/affecting multiple opacities

    Posted by James Hooey on April 14, 2009 at 4:59 pm

    Hope someone can offer some insight into how I would approach the following.

    I have 10 layers set up in a 3D decagon arrangment parented to a null set in the middle of the layers. With this I can rotate all the layers on the y axix effectively creating a spinning decagon.

    What I want to add to this is an expression driven opacity that compares any of the 10 layers angle to the camera and falls off the opacity for layers not facing at a right angle to the camera.

    Another way to put this is for the side of the decagon directly facing the camera I want it’s opacity to be 100% but for each 36 degree layer not facing the camera, I want it’s opacity to lower incrementaly down to 0% depending on it’s degrees of rotation compared to it’s axis to the camera.

    I can understand some of the logic in figuring out this problem but my expressions knowledge is still small so I am having a hard time trying to know how to approach and work with the actual expression language.

    Can anyone guide me as to some of the commands involved and the math priciples?

    All the best,
    James Hooey

    James Hooey replied 17 years ago 2 Members · 4 Replies
  • 4 Replies
  • Dan Ebberts

    April 14, 2009 at 5:18 pm

    It’s going to look something like this:

    C = thisComp.activeCamera;
    v1 =normalize(anchorPoint – fromWorld(C.toWorld([0,0,0])));
    angle = Math.acos(dot(v1,[0,0,1]));
    linear(angle,0,Math.PI,100,0)

    Dan

  • James Hooey

    April 14, 2009 at 5:44 pm

    That’s incredible!

    Thank you so much Dan! It’s almost exactly what I was hoping for. I think I would still like to find a way to tweak it a bit to have a bit faster opacity falloff for layers as they move off axis to the camera….but WOW again thank you so much!

    On another note…have you published a book for AE expressions? I have “After Effects Expressions” by Marcus Geduld and I’m a little underwhelmed by it.

    All the best,
    James Hooey

    If I’m not learning something….I’m bored.

  • Dan Ebberts

    April 14, 2009 at 6:23 pm

    Play around with this version. Adjust “factor” until you get something you like:

    factor = 2;
    C = thisComp.activeCamera;
    v1 =normalize(anchorPoint – fromWorld(C.toWorld([0,0,0])));
    angle = Math.acos(dot(v1,[0,0,1]));
    100/Math.exp(angle*factor)

    No book (yet), but I did write an expressions chapter for the latest edition of Mark Chrisiansen’s book.

    Dan

  • James Hooey

    April 14, 2009 at 7:56 pm

    I’m deeply grateful for you help!
    The second expression is perfect. Adjusted factor to 1.2 and it was great!

    I also looked up Mark’s Book and ordered through Amazon.ca – I do see your contribution to the book so I hope you get a bit of a royalty from it!!

    All the best,
    James Hooey

    If I’m not learning something….I’m bored.

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