Creative Communities of the World Forums

The peer to peer support community for media production professionals.

Activity › Forums › Adobe After Effects › Linking 2 Keyframes to 1 Marker

  • Linking 2 Keyframes to 1 Marker

    Posted by Todd Troop on September 16, 2020 at 8:33 pm

    I’ve seen a lot of expressions linking the start keyframe of an animation to one marker, and linking the end keyframe to a second marker, allowing the user to move and lengthen the animation using the markers. BUT, I’m wanting to link the start and end keyframes to just one marker, so when I slide the marker, both keyframes slide with it. And, I want to do this without making a pre-comp. I’ve attached a screen shot to help illustrate what I’m trying to accomplish. Any help is appreciated!

    Graham Quince replied 6 years ago 2 Members · 1 Reply
  • 1 Reply
  • Graham Quince

    September 20, 2020 at 6:04 am

    A way to achieve the convenience you want, but in a slightly different way would be to use a linear expression to control the animation between the two keyframe values and trigger this from a single marker.

    This is the expression I use to trigger a highligter in my tutorials which I have on the opacity:

    fadetime = 0.5;

    dur = 2;

    if(marker.numKeys > 0){

    m = marker.nearestKey(time).index;

    if(marker.key(m).time > time) {

    m–;

    }

    if(m > 0){

    mt = marker.key(m).time;

    if(time < mt+dur){

    linear(time, mt, mt+fadetime, 0, 100);

    } else {

    linear(time, mt+dur, mt+dur+fadetime, 100, 0);

    }

    } else {

    0

    }

    } else {

    0

    }

    This expression sets a fadetime of 0.5 seconds, sets a dur(ation) of 2 seconds, so that the highlight fades up in 0.5 seconds, and spends 2 seconds onscreen before fading out again.

    The first IF statment if(marker.numKeys > 0){ checks to see if there are any markers on the layer and if not, sets the opacity to 0.

    If there is a marker, when the current time indicator hits one it sets the mt to be the time stamp of that marker: mt = marker.key(m).time;

    Then the linear expression kicks in, linear ( current time , start time, end time, starting value, ending value.

    My expression also triggers the fade out, but if that isn’t needed in your, something like this would work just as well:

    fadetime = 0.5;

    if(marker.numKeys > 0){

    m = marker.nearestKey(time).index;

    if(marker.key(m).time > time) {

    m–;

    }

    if(m > 0){

    mt = marker.key(m).time;

    linear(time, mt, mt+fadetime, 0, 100);

    } else {

    value

    }

    } else {

    value

    }

    I’ve used value here, so that in “rest” the Position Y property can be set to whatever initial value you want.

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