ADOBE AFTER EFFECTS: Forum Expressions Tutorials Creative Cloud

Far Vanish and Near Vanish AE Layers

COW Forums : Adobe After Effects

Respond to this post   •   Return to posts index   •   Read entire thread

Stephen Moore
Far Vanish and Near Vanish AE Layers
on Aug 13, 2019 at 8:37:45 am

Hi All,

I have a camera moving along the Z axis through a series of AE layers and I'd dearly love to be able to Far Vanish/Far Start Fade and Near Start Fade/Near Vanish those layers like in the Visibility tab in Trapcode Form.

I've Googled around and found on (this essentially shows my scene)...

...this code...

start = comp("Fade").layer("Control").effect("FadeStart")("Slider");

end = comp("Fade").layer("Control").effect("FadeEnd")("Slider");

CameraPos = thisComp.activeCamera.toWorld([0,0,0]);

LayerPos = toWorld(anchorPoint);

Difference = length(CameraPos, LayerPos);

linear(Difference, start, end,0,100);

...which works for the Near Fade and this code...

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);

...which works for the Far Fade.

Does anyone know how to combine the two? That would be brilliant!

Many thanks in advance...


Posts IndexRead Thread 

Current Message Thread:

© 2019 All Rights Reserved