Expressions/Scripts/Presets

Moderators: Disciple, zlovatt

 
User avatar
Atomic
Topic Author
Posts: 157
Joined: Mon Apr 30, 2007 5:55 am
Location: United States, Ohio

Expression To Control Z-Position Only

Fri May 02, 2008 1:02 pm

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: 318
Joined: Sat Jun 26, 2004 10:01 am
Location: Folsom, CA
Contact:

Re: Expression To Control Z-Position Only

Fri May 02, 2008 4:52 pm

This should give you the idea:

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
Topic Author
Posts: 157
Joined: Mon Apr 30, 2007 5:55 am
Location: United States, Ohio

Re: Expression To Control Z-Position Only

Mon May 05, 2008 5:29 am

Thank You Dan.
"Up And Atom

No...No

Up And At Them!"

Who is online

Users browsing this forum: No registered users and 2 guests