Creative Communities of the World Forums

The peer to peer support community for media production professionals.

Activity Forums Adobe After Effects Expressions Using distance to control transparency

  • Using distance to control transparency

    Posted by Gerard Bowden on July 14, 2013 at 5:24 am

    Hi, Im trying to control the transparency of an object by using the distance of it with another object. Any help would be much appreciated. thanks

    object1=transform.position;
    object2=thisComp.layer("object2").transform.position;

    distance=length(point1, point2);
    tMin=250;
    tMax=50;
    value1=0;
    value2=100;

    transform.opacity =linear(distance, tMin, tMax, value1, value2);

    Dan Ebberts replied 12 years, 10 months ago 2 Members · 1 Reply
  • 1 Reply
  • Dan Ebberts

    July 14, 2013 at 7:40 am

    Something like this should work. If what you want is just the opposite, switch value1 and value2.

    point1=transform.position;
    point2=thisComp.layer(“object2”).transform.position;
    distance=length(point1,point2);
    tMin=50;
    tMax=250;
    value1=100;
    value2=0;
    transform.opacity =linear(distance, tMin, tMax, value1, value2);

    Dan

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