Adding two Ease expressions to the same property.
I thought I had done this before, but I can't figure it out again.
I have four position keyframes on a reference layer. I want to drive another property on another layer using an Ease interpolation method twice, so the moves are in opposite directions. Did you follow that?
When I only have 2 keyframes, this expression moves a shape layer background from the left edge of the screen until it fits under the moving text layer as the text layer (ref) moves from right to left.
ref = thisComp.layer(index -1);
hPad = effect("X Pad")("Slider");
refP = ref.position;
box = ref.sourceRectAtTime();
xSize = content("Rectangle 1").content("Rectangle Path 1").size[0];
totWidth = box.width + box.left;
if(refP.numKeys < 2)
value;
if(refP.numKeys == 2){
t = time;
tMin = refP.key(1).time
tMax = refP.key(2).time;
value1 = refP[0] - totWidth - hPad/2;
value2 = value1 + xSize;
mov = linear(t, tMin, tMax, value1, value2) - refP[0];
}
[mov, refP[1]]
I need to add two more position keyframes to the ref layer to move it back to the right and have the shape layer move back to the left. The second part of the ease expression would look like this:
{
t = time;
tMin = refP.key(3).time;
tMax = refP.key(4).time;
value1 = refP[0] - totWidth - hPad/2;
value2 = value1 + xSize;
mov = ease(t, tMin, tMax, value2, value1) - refP[0];
}
[mov, refP[1]]
I have been fiddling around with this for about an hour. I can make the shape layer move in or move out, but I can't get it to move in, stay for a while, and then move out.
Any help would be appreciated. If anybody knows, it is Dan Ebberts.

