This content has been marked as final.
Show 3 replies
-
1. Re: Opacity linking to camera location
Dan Ebberts Jan 11, 2009 12:24 PM (in response to spdorsey6969)This will ramp the opacity from 0 to 100 as the layer moves from 0 to 500 pixels away from the camera. Should be easy to modify if it's not exactly what you're after:
maxDist = 500;
minDist = 0;
maxOpacity = 100;
minOpacity = 0;
C = thisComp.activeCamera;
d = length(C.toWorld([0,0,0]),toWorld(anchorPoint));
linear(d,minDist,maxDist,minOpacity,maxOpacity)
Dan -
2. Re: Opacity linking to camera location
spdorsey6969 Jan 11, 2009 12:28 PM (in response to spdorsey6969)That is almost perfect - thank you very much for your help.
One more question. . .
How would I link the "maxDist" to the X value of a null - so that I can move that null and easily adjust the value?
I have MANY layers that I need to use this on, and it's easier to test this way to get the correct settings rather then copy/past the script OVER&OVER&OVER.
Thanks again, I appreciate the help!
-------S -
3. Re: Opacity linking to camera location
spdorsey6969 Jan 11, 2009 12:35 PM (in response to spdorsey6969)I figured it out!
There's hope for me yet!
I have to make sure that x y and z values for my null are computed separately by right-clicking on the null's position attribute and selecting "separate dimensions".
maxDist = thisComp.layer("nullName").transform.xposition;
minDist = 0;
maxOpacity = 100;
minOpacity = 0;
C = thisComp.activeCamera;
d = length(C.toWorld([0,0,0]),toWorld(anchorPoint));
linear(d,minDist,maxDist,minOpacity,maxOpacity)

