Creative Communities of the World Forums

The peer to peer support community for media production professionals.

Activity Forums Adobe After Effects Expressions Linking Keyframes To Layer Marker Question

  • Linking Keyframes To Layer Marker Question

    Posted by Quest Rogers on October 17, 2017 at 5:10 pm

    Hi. I looking for some advice on linking keyframes to a layer marker.

    Normally I only do this with two keyframes using the expression seen below. I’ve seen other examples of this expression linking multiple keyframes to different layer markers. But this isn’t what I’m trying to do.

    I’m trying to figure how to apply some form of this expression to a layer with three keyframes. Keyframes 1 to 2 are a quick animation in. Keyframes 2 to 3 are a slow movement that continues from keyframe 1. So basically a quick animation in, then slow movement. I’d like to be able to control where the last (3rd) keyframe ends in my comp with a layer marker. Is this possible with some form of the expression below?

    L = thisComp.layer("Control");
    if ((L.marker.numKeys > 0) && (numKeys > 1)){
    t1 = key(1).time;
    t2 = L.marker.key(1).time;
    val1 = valueAtTime(key(1).time);
    val2 = valueAtTime(key(2).time);
    linear(time,t1,t2,val1,val2);
    } else {
    value;
    }

    Quest Rogers replied 8 years, 6 months ago 3 Members · 5 Replies
  • 5 Replies
  • Dan Ebberts

    October 17, 2017 at 6:10 pm

    Try this:


    L = thisComp.layer("Control");
    if ((L.marker.numKeys > 0) && (numKeys > 2) && (time > key(2).time)){
    t2 = key(2).time;
    t3 = key(3).time;
    tm = L.marker.key(1).time;
    t = linear(time,t2,tm,t2,t3);
    valueAtTime(t);
    }else
    value

    Dan

  • Quest Rogers

    October 17, 2017 at 7:50 pm

    That did the trick. Thanks Dan! Out of curiosity what’s the ‘tm’ for? Time-marker?

  • Dan Ebberts

    October 17, 2017 at 8:18 pm

    It’s just a variable name for the marker time. I could have used anything. I used ‘tm’ because it’s short and stands out from the variables representing keyframe times.

    Dan

  • Marcelo Cabral

    October 18, 2017 at 12:35 pm

    Hi Dan
    I´m following this post. The expression works awesome! How to modify the expression to trigger the entire animation using two layer marks. I mean, the first mark will trigger the keyframe 1 and the second mark will control when the animation finishes. Thank you!

  • Quest Rogers

    October 18, 2017 at 1:21 pm

    Oh ok. Gotcha. Thanks again!

We use anonymous cookies to give you the best experience we can.
Our Privacy policy | GDPR Policy