🚀 go-pugleaf

RetroBBS NetNews Server

Inspired by RockSolid Light RIP Retro Guy

Thread View: adobe.after.effects.scripting.render
4 messages
4 total messages Started by spdorsey Sun, 11 Jan 2009 18:16
Opacity linking to camera location
#36
Author: spdorsey
Date: Sun, 11 Jan 2009 18:16
9 lines
927 bytes
I may have asked this before, but I cannot find the question.

I'd like to link the opacity of a 3D layer to the location of the camera - so that items become more opaque when they become (for example) 500px from camera. I'd want to adjust the number to suit the animation.

Is this easy? Any resources that anyone knows of to do this?

Thanks

----------S
Re: Opacity linking to camera location
#38
Author: Dan_Ebberts
Date: Sun, 11 Jan 2009 20:24
12 lines
1146 bytes
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
Re: Opacity linking to camera location
#39
Author: spdorsey
Date: Sun, 11 Jan 2009 20:28
11 lines
1012 bytes
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
Re: Opacity linking to camera location
#40
Author: spdorsey
Date: Sun, 11 Jan 2009 20:35
14 lines
1054 bytes
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)
Thread Navigation

This is a paginated view of messages in the thread with full content displayed inline.

Messages are displayed in chronological order, with the original post highlighted in green.

Use pagination controls to navigate through all messages in large threads.

Back to All Threads