Activity › Forums › Adobe After Effects Expressions › link stroke width to camera position
-
link stroke width to camera position
Posted by Todd Morgan on May 9, 2011 at 4:55 pmLooking for help with linking stroke width to camera position z depth. Basically, looking to keep all my outline strokes the same size, even when object fly toward camera. Currently, when object flies towards and past camera, stroke size increases (as it should) but I need to keep all strokes the same for cartoon effect.
Thanks in advance for all responses!
Dan Ebberts replied 11 years, 8 months ago 5 Members · 8 Replies -
8 Replies
-
Dan Ebberts
May 9, 2011 at 8:02 pmSomething like this should help:
nominalDist = 400;
d = length (thisComp.layer(“Camera 1”).toWorld([0,0,0]),toWorld(anchorPoint));
value*(d/nominalDist)Set nominalDist to the distance where you want the stroke width to be the value you have it set to.
Dan
-
Mike Theodoran
November 19, 2012 at 3:58 pmI am trying to achieve the same effect with the stroke linked to the camera to keep the stroke width consistent.
On what layer and what attribute do I put the expression on?
Thanks for any assistance you can offer.
Mike
-
Dan Ebberts
November 19, 2012 at 6:00 pmYou would apply that expression to the stroke width property.
Dan
-
Ze’ev Gilad
September 10, 2014 at 3:44 pmI said it before, I’ll say it again:
Dan, you are the MAN! -
Brien Hopkins
November 24, 2014 at 4:48 pmHi Dan,
I came across this thread today, and your expression works like a charm. I’m curious if there’s a way to achieve a similar effect, when there is no camera in the scene. If the line itself moves in Z space (not the camera) could the stroke remain constant?
Thanks,
Brien -
Dan Ebberts
November 24, 2014 at 9:52 pmYou could try using something like this to simulate a camera:
nominalDist = 400;
w = thisComp.width * thisComp.pixelAspect;
z = (w/2)/Math.tan(degreesToRadians(19.8));
C = [thisComp.width/2,thisComp.height/2,-z];
d = length (C,toWorld(anchorPoint));
value*(d/nominalDist)
Dan
Reply to this Discussion! Login or Sign Up