Skip to content

Instantly share code, notes, and snippets.

@animoplex
Last active April 11, 2018 21:03
Show Gist options
  • Star 0 You must be signed in to star a gist
  • Fork 0 You must be signed in to fork a gist
  • Save animoplex/77eed577a870c54a823817d4a5a33b88 to your computer and use it in GitHub Desktop.
Save animoplex/77eed577a870c54a823817d4a5a33b88 to your computer and use it in GitHub Desktop.
Distance Based Opacity Fade - After Effects Expression by Animoplex
// Distance Based Opacity Fade
// Original: https://helpx.adobe.com/after-effects/using/expression-examples.html
// Full Tutorial: https://www.youtube.com/watch?v=I-Acdl_l9G0&t=14s
startFade = 500;
endFade = 3000;
try {
C = thisComp.activeCamera.toWorld([0,0,0]);
} catch(err) {
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)
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment