Activity › Forums › Adobe After Effects Expressions › script parent // locking position x and y
-
script parent // locking position x and y
Posted by Seb Det on April 8, 2008 at 2:33 pmHello,
I need to parent two layers.
Layer A
Layer BBy moving the layer B (position or everything else), I would like to change the position Z of layer A. I need to do it in the script window of the timeline.
I don’t know how to lock position X and Y.Any solution?
Thanks a lot.
S.Myron Campbell replied 17 years, 12 months ago 4 Members · 5 Replies -
5 Replies
-
Mike Clasby
April 8, 2008 at 4:00 pmI’m not real clear on what you’re doing. Is layer A the Parent of Layer B? And you want to lock down the x and y or Layer A?
To move only the z of Layer A, assuming it’s 3D (little box checked), just scrub the z, the third set of blue numbers. The x and y aren’t “locked down” but only the z will move.
To lock down the x and y, here’s one way.
Add a slider to Layer A (Effect>Expression Control>Slider Control). Name it something like “Z” (double click the slider and rename).
Alt click the Position Stopwatch and write in an expression like this:
[360,240,0]
That will lock the x value at 360, the y at 240, and the z at 0.
Now highlight the “0” in the expression and pickwhip (looks like an asterisk, the middle button just below the now red expression numbers) and pickwhip to the Slider to get an expression like this:
[360,240, effect(“Z”)(“Slider”)]
Now the z is controlled by the slider. If you need to change the range of the slider (0 to 100 by default) Right-Click the number on the slider (up in the Effect Control Panel) and set a new min and max slider range.
Is that what you want?
-
Amit Zinman
May 12, 2008 at 2:24 pmwhat do you use if you want the x and the z to remain without expressions interference (but not with a static value) and just change the y?
-
Mike Clasby
May 12, 2008 at 8:55 pmWith a slider named “Y”, Try this:
Y = effect(“Y”)(“Slider”);
[position[0],Y,position[2]] -
Myron Campbell
May 21, 2008 at 12:48 amI’m having trouble following this.
I have my child layer’s x and z position locked by using this slider technique you’ve mentioned. now i want it to follow the parent with a time offset.
i’m using this code on the child
thisComp.layer(“parent”).transform.position.valueAtTime(time-.5);it works well on its own ( for x y and z only ) , but when i add your slider and slider code i get sytax errors and i can’t get them to work together. any ideas on how to make this code speak to my Y slider?
any help would be much appreciated.
Reply to this Discussion! Login or Sign Up