Creative Communities of the World Forums

The peer to peer support community for media production professionals.

Activity Forums Adobe After Effects Expressions How can I revise this expression so it looks at mask position and not x,y position?

  • How can I revise this expression so it looks at mask position and not x,y position?

    Posted by David Cabestany on December 14, 2015 at 9:52 pm

    I’m trying to obscure a lens flare when it goes in front of another layer. I can’t use Optical Flares built in foreground layers feature because it doesn’t work with mask positions, but rather x,y coordinates.

    Anyone know what should I revise on the expression below so it follows the position of the flare (which is being driven by a mask position (in degrees) instead of a regular x,y position value?

    Thanks in advance,
    D.

    target=thisComp.layer("shape");
    alpha=target.sampleImage((effect("Optical Flares")("Position XY")),[1,1])[3];
    linear(alpha,0,1,45,0);

    David Cabestany replied 10 years, 8 months ago 2 Members · 4 Replies
  • 4 Replies
  • Kalleheikki Kannisto

    December 15, 2015 at 3:22 pm

    If you precomp the masked layer (or a copy thereof) moving the mask inside the precomp, the foreground layer method will work.

  • David Cabestany

    December 15, 2015 at 4:05 pm

    Thanks Kalle, but that didn’t work when I first tried it, hence why I tried the expression instead. The weirdest thing is that I made a test comp within the same project and everything worked fine.

    I contacted Videocopilot and they asked me to send the file, I’m waiting to hear back from them.

    I ended up making a new layer (precomped) with a similar alpha, the only difference is that instead of a shape layer as a source for the precomp I used a solid with a mask, that worked. Why? I have no idea.

    Best,
    D.

  • Kalleheikki Kannisto

    December 16, 2015 at 8:42 am

    It should only make a difference if the mask is inside the precomp (this works) or applied to the precomp (doesn’t work).

  • David Cabestany

    December 16, 2015 at 5:29 pm

    It should, but for some reason it didn’t work. I’m in close contact with Videocopilot’s tech guys trying to sort out the problem.

    Thanks for your help,
    D.

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