Creative Communities of the World Forums

The peer to peer support community for media production professionals.

Activity Forums Adobe After Effects Expressions How to link a shape’s drop shadow direction (Angle) to a nul (Light Source)

  • How to link a shape’s drop shadow direction (Angle) to a nul (Light Source)

    Posted by Kerr Scott on August 4, 2020 at 3:34 pm

    How do I work out the angle value of a shape’s drop shadow angle as it corresponds to a light source controller null? I plan on using this to control the angle of mulitple instances of the drop shadow effect on lots of different shapes.

    I would normally just create an angle control on an adjustment layer and link them all to that but I need the ‘light souce’ to move around and all the drop shadow’s point away from it.

    I understand there will be some maths involved and I’ll have to clamp it somehow to get a value under 360* but if someone could give me a starting point that would be great!

    Here’s a screenshot of what I am starting with.

    Kerr Scott replied 5 years, 9 months ago 2 Members · 2 Replies
  • 2 Replies
  • Chaz Chester

    August 4, 2020 at 11:24 pm

    Using this expression (borrowed from rd:QueEsSpanNull) for the direction should do the trick:

    p1 = [thisComp.layer(“SHADOW LIGHT SOURCE”).transform.position[0]*thisComp.pixelAspect, thisComp.layer(“SHADOW LIGHT SOURCE”).transform.position[1]];
    p2 = [thisLayer.transform.position[0]*thisComp.pixelAspect, thisLayer.transform.position[1]];
    delta = p1-p2;
    (Math.atan2(delta[1], delta[0])*180/Math.PI)-90;

  • Kerr Scott

    August 5, 2020 at 8:06 am

    That worked perfectly, thank you!

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