ADOBE AFTER EFFECTS: Forum Expressions Tutorials Creative Cloud

Link 4 keyframes to 4 markers

COW Forums : Adobe After Effects Expressions

<< PREVIOUS   •   FAQ   •   VIEW ALL   •   PRINT   •   NEXT >>
John Sing
Link 4 keyframes to 4 markers
on Apr 3, 2019 at 4:34:50 pm

Hi,
I've created an animation using Separate XY Position effects, I have 2 keyframes for the X movement and 2 keyframes for the Y movement for the INTRO ANIMATION,

I've linked the intro animation to 2 MARKERS with the expression below:

L = comp("01DESIGN STD").layer("[CARDS]");
if ((L.marker.numKeys > 0) && (numKeys > 1)){
t1 = L.marker.key(1).time;
t3 = L.marker.key(2).time;
t2 = (t1+t3)/2;
v1 = valueAtTime(key(1).time);
v2 = valueAtTime(key(2).time);
ease(time,t1,t2,v1,v2)
}else{
value
}


(I've added this line t2 = (t1+t3)/2 because I wanted the animation to stop in the middle: so that the object moves on the X axis, then stop and then moves on the Y axis)

And this works fine,

Now I want to add 2 more MARKERS for the OUT ANIMATION,

So I've created 2 more keyframes on the X Position and 2 more on the Y position (in total now I have 4 keyframes for the X and 4 for the Y, with keyframes 2 and 3 of equal value)

I would like to link this last keyframes to the 2 new MARKERS so that I can control the out animation with this 2 markers, I've tried to modify the Expression in the way posted here below

But now the objects are linked only to the MARKERS 3 and 4 (works only the OUT ANIMATION while the IN ANIMATION stops working)

Is there a way to control 4 keyframes with 4 markers?

In a way that the first 2 markers control the first 2 keyframes and the last 2 markers control the last 2 keyframes?

L = comp("01DESIGN STD").layer("[CARDS]");
if ((L.marker.numKeys > 0) && (numKeys > 1)){
t1 = L.marker.key(1).time;
t3 = L.marker.key(2).time;
t2 = (t1+t3)/2;
t4 = L.marker.key(3).time;
t6 = L.marker.key(4).time;
t5 = (t4+t6)/2;
v1 = valueAtTime(key(1).time);
v2 = valueAtTime(key(2).time);
v3 = valueAtTime(key(3).time);
v4 = valueAtTime(key(4).time);
easeIn(time,t1,t2,v1,v2)
easeOut(time,t5,t6,v3,v4)
}else{
value
}


Return to posts index

Dan Ebberts
Re: Link 4 keyframes to 4 markers
on Apr 3, 2019 at 5:20:14 pm

Try replacing this part:

easeIn(time,t1,t2,v1,v2)
easeOut(time,t5,t6,v3,v4)

with this:


if (time < t3){
easeIn(time,t1,t2,v1,v2);
}else{
easeOut(time,t5,t6,v3,v4);
}


Dan



Return to posts index

John Sings
Re: Link 4 keyframes to 4 markers
on Apr 3, 2019 at 5:37:37 pm

It works perfectly! Thank you very much Dan!


Return to posts index

<< PREVIOUS   •   VIEW ALL   •   PRINT   •   NEXT >>
© 2019 CreativeCOW.net All Rights Reserved
[TOP]