Creative Communities of the World Forums

The peer to peer support community for media production professionals.

Activity Forums Adobe After Effects Expressions Control Animation with markers e.g. IN and OUT and then IN again

  • Control Animation with markers e.g. IN and OUT and then IN again

    Posted by Mateo Baldasare on September 12, 2023 at 7:33 pm

    Hi there! I hope you are well 😃
    I’m trying to achieve the following:
    Use the markers’ comments of a layer to drive the animation and be able to use another marker with the same comment again. For example:

    The camera Zoom begins at a value of 2,000 with the marker IN” and then interpolates to a value of 5,000 when it reaches the marker “OUT”, AND if I add another “IN” marker after that, it should go back to 2,000

    This is what I did but it only animates between the first two markers (which makes sense):
    markerIN = thisLayer.marker.key(“IN”);
    mIN = markerIN.time;
    markerOUT = thisLayer.marker.key(“OUT”);
    <i style=”background-color: var(–bb-content-background-color); font-family: inherit; font-size: inherit; color: var(–bb-body-text-color);”>mOUT= markerOUT.time;
    <i style=”background-color: var(–bb-content-background-color); font-family: inherit; font-size: inherit; color: var(–bb-body-text-color);”>ease(time, mIN, mOUT, 2000, 5000);

    Thank you!

    Brie Clayton
    replied 1 year, 1 month ago
    3 Members · 3 Replies
  • 3 Replies
  • Dan Ebberts

    September 12, 2023 at 8:28 pm

    It will look something like this (although this may not be exactly right depending on what should happen if there are no markers, or other markers besides IN and OUT):

    m = marker;
    v1 = 2000;
    v2 = 5000;
    val = v1;
    if (m.numKeys > 0){
    n = m.nearestKey(time).index;
    if (time < m.key(n).time) n--;
    if (n > 0){
    if (m.key(n).comment == "IN"){
    val = v1;
    if (n < m.numKeys && m.key(n+1).comment == "OUT"){
    val = ease(time,m.key(n).time,m.key(n+1).time,v1,v2);
    }
    }else if (m.key(n).comment == "OUT"){
    val = v2;
    if ( n < m.numKeys && m.key(n+1).comment == "IN"){
    val = ease(time,m.key(n).time,m.key(n+1).time,v2,v1);
    }
    }
    }
    }
    val
  • Mateo Baldasare

    September 12, 2023 at 8:39 pm

    That worked perfectly, Dan, thank you so much 🙏 It was much more complex than I thought it’d be.

  • Brie Clayton

    September 13, 2023 at 6:11 pm

    Thank you for the solve, Dan!

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