Creative Communities of the World Forums

The peer to peer support community for media production professionals.

Activity Forums Adobe After Effects Expressions Need to relate the drop shadow effect of a pre-comp to the Light layer of the main comp

  • Need to relate the drop shadow effect of a pre-comp to the Light layer of the main comp

    Posted by Rafael Ribeiro on August 4, 2012 at 8:09 pm

    I got a comopsition filled with lots of pre-comps ( imagine that a wall in 3d space is the main composition and the pre-compositions are pictures with frames – chaplets to be really clear, I think).
    The pictures are hanging on that wall, and theres a light layer in the main commposition. The chaplets ( pre-comps with pictures) have a drop shadow effect (inside the pre-comp), to give a nice look, almost realistic that there’s actually a picture inside of them.

    How can I relate the direction of the drop shadow effect inside the pre-composition, to the Light layer in the main composition?

    Thanks for reading. 🙂

    Dan Ebberts replied 14 years, 1 month ago 2 Members · 5 Replies
  • 5 Replies
  • Dan Ebberts

    August 4, 2012 at 9:09 pm

    If you’re using the Drop Shadow effect, something like this should work:

    L = comp(“Main Comp”).layer(thisComp.name);
    p1 = L.fromWorld(comp(“Main Comp”).layer(“Light 1”).toWorld([0,0,0]));
    p2 = toWorld(anchorPoint);
    d = p1 – p2;
    radiansToDegrees(Math.atan2(d[1],d[0]))-90

    If you’re using the drop shadow layer style, you’ll need to change the last line to this:

    -radiansToDegrees(Math.atan2(d[1],d[0]))

    Dan

  • Rafael Ribeiro

    August 4, 2012 at 9:42 pm

    neither of the expressions worked. I moved the light around but the shadow of the pre-comp did not follow it’s movement at all.

    What did I do wrong (haha) ?

  • Dan Ebberts

    August 4, 2012 at 10:02 pm

    The drop shadow is applied to a layer inside the precomp, correct? Or is the drop shadow applied to the precomp as a layer inside the main comp?

    Dan

  • Rafael Ribeiro

    August 4, 2012 at 10:10 pm

    it is applied to a layer inside the pre-comp, yes.
    I didn’t get any code errors or anything. But the drop shadow won’t move as the “Light 1” layer moves too.

  • Dan Ebberts

    August 4, 2012 at 10:15 pm

    I’m stumped. It works here. I must have something set up differently than you do…

    Dan

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