You'll need to create two relationships -
1) between the two trays
When one tray moves down by a value, the other tray has to move up by the same amount.
2) between the trays and the horizontal bar
When either one of the tray moves, the horizontal bar's rotation values kicks in. We will use the right tray to drive the horizontal bar's rotation values as well as the left tra's Y-position.
It's best to create a Null to use as a Controller Layer that holds the Expression Sliders that we'll be using.
Create the Null and apply the Expression Slider five times and change each of their names to -
MaxRotation
MinRotation
MaxYPosition
MinYPosition
StartRightYPos
Type the following values in the Slider value inpit parameterfor the above Expression Controllers-
MaxRotation = 70
MinRotation = -70
MaxYPosition = 530
MinYPosition = 0
StartRightYPos = 400
While most of the values can be adjusted, the StartRightYPos parameter has to be exactly the starting values for the trays. I am assuming that the trays start off at equal heights.
Now put the following script into the horizontal bar's Rotation Expression -
//Start Script
MaxRotation = thisComp.layer("Null 1").effect("MaxRotation")("Slider");
MinRotation = thisComp.layer("Null 1").effect("MinRotation")("Slider");
MaxYPos = thisComp.layer("Null 1").effect("MaxYPos(right)")("Slider");
MinYPos = thisComp.layer("Null 1").effect("MinYPos(right)")("Slider");
LayerProp = thisComp.layer("right").position[1];
LeftYPos = thisComp.layer("left").position[1];
RightYPos = thisComp.layer("right").position[1];
if (LeftYPos==RightYPos)
0
else
linear(LayerProp,MinYPos,MaxYPos,MinRotation,MaxRotation)
// End of SCript
And for the left tray, put the following script into its Position property's Expression box -
// Start Script
RightYPos = thisComp.layer("right").position[1];
StartYPosRight = thisComp.layer("Null 1").effect("Start RigthYPos")("Slider");
[value[0],((value[1]-RightYPos)+StartYPosRight)]
// End SCript
Once you have these setup, you simply have to animate the Y-positionof the right tray to get the Horizontal bar to rotate. How much it rotates depends on the values for MinRotation and MaxRotation and even MinYPosition and MaxYPosition value adjustments will affect the sensitivity of the amount of rotation depending on the y movement of the right tray.
HTH
RoRK
Sell your AEPs with broadcastGEMs' DVD series of templates. Click
here for more