Mailing List AE-List@media-motion.tv ? Message #50549
From:
Alex Czetwertynski <alex@disciplefilms.com>
Subject:
Re: [AE] Fading a light beyond a certain angle
Date:
Wed, 21 Aug 2013 15:29:36 -0400
To:
After Effects Mail List <AE-List@media-motion.tv>
Thanks!
On Wed, Aug 21, 2013 at 2:40 PM, Darby Edelen <dedelen@gmail.com> wrote:
And I didn't double check my expression before sending it out. The variable names are mismatched. Here it is fixed:
range = 90; d = Math.cos(degreesToRadians(range / 2));
c = thisComp.layer("Camera 1"); cv = c.toWorldVec([0,0,-1]); v = toWorldVec([0,0,1]); facing = dot(v,cv); linear(facing, d, 1, 0, value);
Sorry for the expression spam ;)
On Wed, Aug 21, 2013 at 11:32 AM, Darby Edelen <dedelen@gmail.com> wrote:
Reading again I think we're talking about a spotlight rotating. Sorry for the misunderstanding on my part. I'd try something like this in that case:
range = 90; d = Math.cos(degreesToRadians(falloff / 2));
c = thisComp.layer("Camera 1"); cv = c.toWorldVec([0,0,-1]); v = toWorldVec([0,0,1]); facing = dot(v,cv); linear(facing, d, 1, 0, value);
Here the 'range' defines the section out of the 360° rotation that the spotlight is on. The spotlight will be brightest when pointing in the opposite direction the camera is pointing and fade down as it approaches the edge of its 'range.'
One thing to note is that this expression works as the light rotates around either the x or y-axis. So rotating the light on the x-axis will have a similar effect as rotation on the y-axis.
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.
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…