Creative Communities of the World Forums

The peer to peer support community for media production professionals.

Activity Forums Adobe After Effects Expressions Lens Flare position to rotation expression

  • Lens Flare position to rotation expression

    Posted by Chris Standley on June 29, 2009 at 8:11 pm

    Sincere apologies if this has already been covered, but I couldn’t find it anywhere, so I thought I’d ask!

    I’ve built a composition containing a planet and moon built with CC Sphere. I’ve put a lens flare in there as a sun and I want to set an expression so that when I move the lens flare, the angle of the light in CC Sphere matches the position of the sun – just like in the real world.

    Any thoughts?

    Chris

    Dan Ebberts replied 16 years, 10 months ago 2 Members · 3 Replies
  • 3 Replies
  • Dan Ebberts

    June 29, 2009 at 8:49 pm

    Give this a try:

    L = thisComp.layer(“sun”);
    P1 = L.toComp(L.effect(“Lens Flare”)(“Flare Center”));
    P2 = toComp(anchorPoint);
    delta = P1 – P2;
    angle = radiansToDegrees(Math.atan2(delta[1],delta[0])) + 90

    Dan

  • Chris Standley

    June 30, 2009 at 11:11 am

    Mr Ebberts – you are a master.
    Thank you so much for this.
    Now if I could just figure out how the maths actually works….

    Would you mind if I include this in a tutorial I’m doing? I’ll happy say you supplied it.

    Chris

  • Dan Ebberts

    June 30, 2009 at 9:01 pm

    Chris,

    Sure, I have no problem with you including it in a tutorial.

    Dan

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