Page 1 of 1

Expression To Control Z-Position Only

Posted: May 2nd, 2008, 1:02 pm
by Atomic
Hi All,

I am trying to make a comp that has two slider controls.

These two sliders represent the "Far Point" and "Near Point" of the layer they are controlling.
I want to be able to traditionally key frame the x,y position, but I want the slider controllers to control the z position only.

Imagine a layer with two key frames. The first key frame would grab the z-position from the "Far Point" controller and the Second keyframe would grab the z-position from the "Near Point" controller. Ideally I would like interpolation between the far and near point as well.

Can this be done?

Re: Expression To Control Z-Position Only

Posted: May 2nd, 2008, 4:52 pm
by Dan Ebberts
This should give you the idea:

Code: Select all

near = effect("near")("Slider");
far =effect("far")("Slider") ;
tNear = key(1).time;
tFar = key(2).time;
z = linear(time,tNear,tFar,near,far);
[value[0],value[1],z]
You could make it fancier by adding code so that it doesn't fail if there aren't two keyframes.

Dan

Re: Expression To Control Z-Position Only

Posted: May 5th, 2008, 5:29 am
by Atomic
Thank You Dan.