Activity › Forums › Adobe After Effects Expressions › Linkin z position to scale
-
Linkin z position to scale
Posted by Göran Thorén on April 14, 2010 at 6:50 amHi all!
So I have tried to figure this out but since I’m not very good with numbers I need some help.What I’m trying to accomplish is this:
Setting up 3d layers in a comp and when I move the layer back in z space, the layer scales accordingly to have the same size as before.
If you look at the layer through the camera it should appear that the layer hasn’t change. Does that make any sense?Göran
Thomas Maloney replied 10 years, 10 months ago 5 Members · 8 Replies -
8 Replies
-
Andy George
April 14, 2010 at 7:31 pmHi Göran,
This is from the adobe help manual
https://help.adobe.com/en_US/AfterEffects/9.0/WS3878526689cb91655866c1103906c6dea-79fca.htmlHere’s an expression for the Scale property of a layer that maintains the relative size of the layer in frame while changing the z position (depth) of a layer or the Zoom value of a camera:
cam = thisComp.activeCamera;
distance = length(sub(position, cam.position));
scale * distance / cam.zoom;-Andy
-
Göran Thorén
April 14, 2010 at 8:04 pmThank’s a million Andy!!!
That works exactly as I want!
I just realized that the anchor point needs to be EXACTLY in the middle of the layer, now I just need to figure out how to find that out numerically (I tried the expression on a text layer which applies the anchor at the bottom left corner by default for some strange reason). Like I said before, I’m really terrible with math and numbers, unfortunately I’ve had this handicap all my life, it’s called dyscalculia and I have tried to seriously learn expression several times but I get stuck when all the math comes in…Again, thank’s Andy for helping guys like me!
Göran
-
Andy George
April 14, 2010 at 8:25 pmGöran,
Your welcome. Maybe this script would help to
center all of your anchor points-https://aescripts.com/repositionanchorpoint/
-Andy
-
Michael Tew
March 18, 2014 at 7:11 pmmaybe I am crazy…but I seem to remember some kind of Vulcan nerve pinch sort of key combination to hold down WHILE changing the z position that would maintain scale (assuming the anchor points were lined up correctly).
am I wrong? And if so …..what is that combination because I forgot it a long time ago.
-
Thomas Maloney
June 23, 2015 at 2:57 pmHello,
Hopefully you get this cause i know its years later. Can i specifiy a camera instead of only active camera?Basically, i will use 1 camera to set the stage, then another camera to animate, but since the script says “activeCamera” it shifts
Thanks!
-
Dan Ebberts
June 23, 2015 at 4:22 pmYou just need to change the first line:
cam = thisComp.layer(“Camera 1”);
Dan
Reply to this Discussion! Login or Sign Up