Expression To Control Z-Position Only

Moderators: Disciple, zlovatt

Post Reply
User avatar
Atomic
Posts: 157
Joined: April 30th, 2007, 5:55 am
Location: United States, Ohio

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?
"Up And Atom

No...No

Up And At Them!"
Dan Ebberts
Posts: 320
Joined: June 26th, 2004, 10:01 am
Location: Folsom, CA
Contact:

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
User avatar
Atomic
Posts: 157
Joined: April 30th, 2007, 5:55 am
Location: United States, Ohio

Thank You Dan.
"Up And Atom

No...No

Up And At Them!"
Post Reply