-
Fade opacity of a 3D shape layer based on distance from another layer
Hi.
I have a grid of images roughly 16×16, and a Line (shape layer) snaking through the vertical and horizontal gaps of the grid until it drops out the bottom.
I am trying to get my head around a script that would change the opacity of the images as the line passed between them, so as the line moves past the images, they would appear.
I found the script below on the adobe website which changes the opacity of a layer depending on the distance from the camera, I tried to use a Null instead of a camera that followed the line, but with no success,
Anyone any ideas?
Thanks
K
startFade = 500; // Start fade 500 pixels from camera.
endFade = 1500; // End fade 1500 pixels from camera.
try{ // Check whether there's a camera.
C = thisComp.activeCamera.toWorld([0,0,0]);
}catch(err){ // No camera, so assume 50mm.
w = thisComp.width * thisComp.pixelAspect;
z = (w/2)/Math.tan(degreesToRadians(19.799));
C = [0,0,-z];
}
P = toWorld(anchorPoint);
d = length(C,P);
linear(d,startFade,endFade,100,0)