After Effects CS3  |  Go to CS4 Help

Example: Fade a 3D layer’s opacity based on distance from camera

  Apply the following expression to a 3D layer’s Opacity property:
  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)

The fade starts at a distance of 500 pixels from the camera and is complete at 1500 pixels from the camera. The linear interpolation method is used to map distance values to opacity values.




Comments

Comments are no longer accepted for After Effects CS3. After Effects CS4 is the current version. To discuss After Effects CS3, please use the Adobe forum.

 

Send me an e-mail when comments are added to this page | Comment Report

Current page: http://livedocs.adobe.com/en_US/AfterEffects/8.0/WS45F04775-D646-4b72-9FDF-E8A46AA1475F.html