React to Layer Distance
Scale, rotate, or change opacity based on distance from another layer.
Expression Code
// React to Layer Distance// Apply to Scale, Rotation, or Opacity// Set the target layer name belowtarget = thisComp.layer("Controller"); // Change to your layer namemaxDist = 500; // Maximum reaction distanceminVal = 50; // Value when far awaymaxVal = 100; // Value when closemyPos = thisLayer.toWorld(anchorPoint);targetPos = target.toWorld(target.anchorPoint);d = length(myPos, targetPos);t = linear(d, 0, maxDist, maxVal, minVal);[t, t]; // For Scale — use just t for Rotation or Opacity
Create a null or shape layer called "Controller". Apply this to Scale, Rotation, or Opacity. Move the controller around — nearby layers react to its proximity.