Creative Communities of the World Forums

The peer to peer support community for media production professionals.

Forums Adobe After Effects Expressions expression to show comments and duration between markers :)

  • expression to show comments and duration between markers :)

  • Chifei Soong

    May 25, 2012 at 9:22 am

    source text expression:
    small expression to display duration between markers in layer.
    (modified from Dan’s marker expression)
    ————————
    need help:
    now the expressions gets the time from nearest markerKey, need to make the expression hold until the next marker, so that the value wont change half-way between 2 markers
    Thanks 😀

    p=thisLayer; //layer where the markers is

    if (p.marker.numKeys > 0) try{
    n = p.marker.nearestKey(time).index;
    m = p.marker.key(n).time; m2=p.marker.key(n+1).time;
    c=p.marker.key(n).comment;
    v=m2-m;
    }
    catch(err){ c=p.marker.key(n).comment; m=0; m2=p.marker.key(n).time; m3=thisComp.duration; v=m3-m2;}

    c+"r"+timeToTimecode(v)

  • Dan Ebberts

    May 25, 2012 at 4:26 pm

    I think you’re after something like this:

    m = thisLayer.marker; //layer where the markers is
    n = 0;
    if (m.numKeys > 0){
    n = m.nearestKey(time).index;
    if (m.key(n).time > time) n--;
    if (n == m.numKeys){ // after last marker
    t = thisComp.duration - m.key(n).time;
    c = m.key(n).comment;
    }else if (n == 0){ // before first marker
    t = m.key(1).time;
    c = "";
    }else{ //between two markers
    t = m.key(n+1).time - m.key(n).time;
    c = m.key(n).comment;
    }
    }else{ // no markers
    t = thisComp.duration;
    c = "";
    }

    c + "r" + timeToTimecode(t)

    (note that the “r” in the last line should be “(backslash)r”

    Dan

  • Chifei Soong

    May 25, 2012 at 4:54 pm

    Yes it works perfectly as i wanted.

    🙂 thanks Dan!

  • Chifei Soong

    February 29, 2020 at 8:42 am

    Hi Dan
    I just wanted to thank you again.
    8 years, this script still serving me well ????

Viewing 1 - 4 of 4 posts

Log in to reply.

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