Creative Communities of the World Forums

The peer to peer support community for media production professionals.

Activity Forums Adobe After Effects Expressions Play only frames with markers

  • Play only frames with markers

    Posted by Anna Tow on May 23, 2012 at 7:11 am

    Hi,
    I copied this expression from Mark Christiansen’s AE CS5 Studio Techniques.

    I’m working on video footage in CS5.5 and the code doesn’t work properly. I have applied several markers to the video layer with Time Remapping added. The expression plays the first marker on the first frame and the last marker on the second frame. Everything else after is frozen on this frame. I cant work this one out. Does anyone else have this problem? Can anyone help me fix this issue?
    Thanks in advance!

    n = marker.numKeys;
    if (n > 0){
    f = timeToFrames (time);
    idx = Math.min (f +1, n);
    marker.key(idx).time
    }else{
    value
    }

    Danny Princz replied 13 years, 11 months ago 3 Members · 7 Replies
  • 7 Replies
  • Dan Ebberts

    May 23, 2012 at 10:25 am

    Wow–that’s a really strange one. It works in 5.0 and 6.0, but not 5.5.
    This seems to fix it for 5.5, although I’m not sure why it’s necessary:


    n = marker.numKeys;
    if (n > 0){
    f = timeToFrames (time);
    idx = Math.min (Number(f)+1, n);
    marker.key(idx).time
    }else{
    value
    }

    Dan

  • Anna Tow

    May 23, 2012 at 10:01 pm

    Thanks Dan,
    that is an improvement but I was expecting the frames changing as the time indicator moved through the markers in real time, not all the marked frames playing out in the first several frames of the footage. 🙂

  • Dan Ebberts

    May 23, 2012 at 10:09 pm

    It’s doing what it was designed to do, but it sounds like you’re looking for something else. Did you want it to hold the frame at each marker until the comp time gets to the next marker?

    Dan

  • Anna Tow

    May 26, 2012 at 12:51 am

    Hi Dan,
    Yes that’s what I’m looking for. I would like to flexibility of moving markers around to different frames for a stop-motion effect the last frame is frozen until the Time marker gets to the next marker. I would just use Time Remapping and Hold keyframes if I didnt want the option to change the frame and the timing easily. As I’m an expression novice, I’m a bit clueless. Obviously the expression I’m looking for would be much more involved.

  • Dan Ebberts

    May 26, 2012 at 1:02 am

    Try this:


    n = 0;
    m = marker;
    if (m.numKeys > 0){
    n = m.nearestKey(time).index;
    if (m.key(n).time > time) n--;
    }
    if (n > 0)
    m.key(n).time
    else
    value

    Dan

  • Anna Tow

    May 27, 2012 at 2:06 am

    Thanks Dan.
    It works. Cheers.

  • Danny Princz

    June 12, 2012 at 5:46 pm

    was just using this expression and it wasnt working because my layer wasnt start at the beginning of the comp

    i hacked in the inPoint of the layers start time and it seems to work now

    i=inPoint
    m = marker;
    if (m.numKeys > 0){
    n = m.nearestKey(time).index;
    if (m.key(n).time > time) n–;
    }
    if (n > 0)
    m.key(n).time-i
    else
    value

    who is that masked man…
    https://www.exposedideas.com/

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