Creative Communities of the World Forums

The peer to peer support community for media production professionals.

  • Posted by Matt Larson on November 11, 2009 at 5:45 pm

    I have been searching and searching, but I can’t seem to find an answer to what I would think would be an easy question:

    Is there an expression that I can add to loopOut that will stop a loop at a certain time on the layer (rather than loop to the out point) and hold that position?

    I know I can precomp and time-remap to 0, but I figured there would be an expression that I don’t know about.

    Any ideas?

    2 x3Ghz Quad MacPro
    9 GB RAM
    Mac OS X 10.5.5
    QT 7.5.5
    FCP 6.0.5
    AJA Kona 3 (6.0.1 drivers)
    G-Speed XL 12 RAID

    Yoan Boisjoli replied 1 month ago 10 Members · 12 Replies
  • 12 Replies
  • Kevin Camp

    November 11, 2009 at 10:28 pm

    i would use a layer marker to set the stop point (with layer selected, hit * on the numbers pad to add a marker) this would make it easy to edit the stop point.

    then try this expression:

    stop = marker.key(marker.numKeys).time;
    loopDur = key(numKeys).time;
    if (time > stop){
    stop%loopDur;
    }else{
    loopOut();
    }

    if you want to enter a specific time value, just set the stop value to a number (in seconds).

    Kevin Camp
    Senior Designer
    KCPQ, KMYQ & KRCW

  • David Cabestany

    March 6, 2014 at 12:45 am

    Hey Kevin, this works nice for a one dimension loop, like rotation, but could you help me to adapt the expression to work with a 3 dimension array, like position x,y and z?

    Thanks,
    David.

  • Mahdi Mehrabi

    August 27, 2015 at 5:07 am

    I can use this expression
    Every time I see the error

    loopOut(type = "cycle", numKeyframes = 0)
    stop = marker.key(marker.numKeys).time;
    loopDur = key(numKeys).time;
    if (time > stop){
    stop%loopDur;
    }else{
    loopOut();
    }

  • Dan Ebberts

    August 27, 2015 at 6:37 am

    You’ll get that error if the layer has no markers.

    Dan

  • Mahdi Mehrabi

    August 27, 2015 at 7:00 am

    thanks dear Dan Ebberts

    The problem was solved by creating markers

    But I get another error in scale parameter

    loopOut(type = "cycle", numKeyframes = 0)
    stop = marker.key(marker.numKeys).time;
    loopDur = key(numKeys).time;
    if (time > stop){
    stop%loopDur;
    }else{
    loopOut();
    }

  • Søren Nowakowski

    September 2, 2015 at 9:34 am

    Alternatively, you could link the loopOut to a checkbox controller.

    That way, you keyframe the switch, to stop it at a point in time of your choosing. Checkbox controls utilizes hold keyframes.

    Just add a checkbox controller to the layer you want the loopOut to happen on.

    And put this code in all the properties you want to have looped.

    s = effect("Stop LoopOut")("Checkbox"); // Parent to Checkbox controller. Rename the controller "Stop LoopOut" if you want :)

    if (s == 0) {
    loopOut("cycle")
    } else {
    value
    }

    /* If the checkbox is off (0), then loop it. Loop it good.
    Otherwise, just use the value (your keyframes). */

  • Mahdi Mehrabi

    September 3, 2015 at 10:31 am

    I can only really thank you Søren Nowakowski

  • Derin Denizli

    September 2, 2016 at 6:34 pm

    getting same error even i assigned 2 markers to layer 🙁

  • Dan Ebberts

    September 2, 2016 at 7:13 pm

    which error?

  • Pete Burges

    November 7, 2017 at 3:49 am

    Hi All

    I’ve been using this expression a lot when I have multiple animating layers and I simply want to trigger the animations on or off rather than key every single one, so thanks for that!
    However, I was wondering…is it possible to stop and start a looping animation where it holds at the current frame when you stop and then continues from there when you start again? Like toggling ‘pause’ on a video player.
    I am not great with scripting so I can’t seem to figure this out by myself…I tried throwing in a frameAtTime but I just broke it.
    I know I can do it with time remapping, and keying a pause in by hand- but over 50 layers with different pause times… I hope someone might have a more elegant solution. 🙂

Page 1 of 2

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