Mailing List AE-List@media-motion.tv ? Message #50546
From: Darby Edelen <dedelen@gmail.com>
Subject: Re: [AE] Fading a light beyond a certain angle
Date: Wed, 21 Aug 2013 10:48:00 -0700
To: After Effects Mail List <AE-List@media-motion.tv>
I'm not sure that I've understood the goal but here's an expression that will fade the light as it leaves a specified field of view:

inner = 20;
outer = 50;
if(inner < outer){
    c = thisComp.layer("Camera 1");
    cv = [0,0,1];
    p = normalize(c.fromWorld(toWorld([0,0,0])));
    iBound = Math.cos(degreesToRadians(inner / 2));
    oBound = Math.cos(degreesToRadians(outer / 2));
    angle = dot(p,cv);
    linear(angle, iBound, oBound, 0, value);
}
else value;

So in the above example the light would be at 'value' intensity when it's within a 20° range of the view center and 0% intensity when it's outside of 50° from view center. If you want the light to turn off quickly choose an inner value that is close to the outer value.  If you want it to fade gradually choose values that are farther apart.

I've only included rudimentary error prevention so if inner and outer are the same value or inner is larger than outer the expression will default to the light's keyframed intensity.


On Tue, Aug 20, 2013 at 5:58 PM, Alex Czetwertynski <alex@disciplefilms.com> wrote:
Hello

I'm trying to figure out an expression to control the brightness of a rotating light.
My light is turning on itself, on the Y axis.  Everytime it passes 90 degrees, rotating away from the camera, I'd like to reduce its intensity, and then bring it back when it is starting to enter the quadrant in which it will face the camera.

If the camera was just rotating once, I'd use a linear expression that mapped 180 to 270 degrees and faded the light in between those two values, but it is constantly looping…
I thought I might be able to use Radians, but they, obviously, keep increasing with the degrees…

Any suggestions?

Thanks!
Alex


+---End of message---+
To unsubscribe send any message to <ae-list-off@media-motion.tv>

 
Subscribe (FEED) Subscribe (DIGEST) Subscribe (INDEX) Unsubscribe Mail to ListMaster