2D Proximity Fade

Fades the layer based on its distance to another 2D layer.

Code

targetLayer = thisComp.layer("Target");
fadeDist = 300;
d = length(position, targetLayer.position);
linear(d, 0, fadeDist, 100, 0)
2Dpositionfadeproximity effectreactive effect

How to Use

Apply this to the Opacity property of your layer. Rename the 'Target' layer or update the expression accordingly. The layer becomes fully visible when close to the target and fades out when it moves farther away.