ADOBE AFTER EFFECTS: Forum Expressions Tutorials Creative Cloud

Far Vanish and Near Vanish AE Layers

COW Forums : Adobe After Effects

<< PREVIOUS   •   FAQ   •   VIEW ALL   •   PRINT   •   NEXT >>
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)...

https://macprovideo.com/article/after-effects/using-distance-from-camera-to...

...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);
linear(d,startFade,endFade,100,0)

...which works for the Far Fade.

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

Many thanks in advance...


Stephen


Return to posts index

Cassius Marques
Re: Far Vanish and Near Vanish AE Layers
on Aug 13, 2019 at 2:25:17 pm

Sure:startFadeNear = 300;
endFadeNear = 600;
startFadeFar = 800;
endFadeFar = 1500;

C = thisComp.activeCamera.toWorld([0,0,0]);
P = toWorld(anchorPoint);
e = length(C,P);

if (e<600)

linear(e,startFadeNear,endFadeNear,0,100)
else{
linear(e,startFadeFar,endFadeFar,100,0)
}


Cassius Marques
http://www.zapfilmes.com


Return to posts index

<< PREVIOUS   •   VIEW ALL   •   PRINT   •   NEXT >>
© 2019 CreativeCOW.net All Rights Reserved
[TOP]