Creative Communities of the World Forums

The peer to peer support community for media production professionals.

Activity Forums Adobe After Effects Layer opacity based on proximity to a camera.

  • Layer opacity based on proximity to a camera.

    Posted by Andrew Kramer on October 28, 2006 at 2:06 pm

    I’m trying to automate an effect, where as a layer gets within 100 pixels of a camera it begins to fade out and at say 10 pixels it disappears. It will probably fade back up when the layer passes the camera but that’s okay.

    The idea is that when a camera is pushed through 3d layers they will autmatically fade out.

    Any help will sure save me some time… Thanks,
    Andrew Kramer

    Andrew Kramer replied 19 years, 9 months ago 3 Members · 3 Replies
  • 3 Replies
  • Brian Charles

    October 28, 2006 at 3:59 pm

    A bit of a kludge but this works bases on Z position, won’t work otherwise. Attach to Opacity of layer.

    T = 100;
    camZ = thisComp.layer(“Camera 1”).transform.position[2];
    myZ = transform.position[2];
    diff = 100 -(camZ+myZ);
    if (diff > ( 20)) {
    T = diff ;
    }else{
    if (diff < 0); T = 0; } T

  • Dan Ebberts

    October 28, 2006 at 4:03 pm

    This should do it:

    dist = length(position,thisComp.layer(“Camera 1”).position);
    linear(dist,10,100,0,100)

    Dan

  • Andrew Kramer

    October 28, 2006 at 4:47 pm

    Very Cool! Thanks for your help guys.

    Brian, very Ambitious, but as you probably guessed I need to have it work from every axis, although I think I have learned how to arrange an “if” scenario.
    Dan your script is like candy. I’ve printed it up and am going to enjoy it tonight after dinner. Beautiful.

    Thanks again buys,
    Andrew

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