Creative Communities of the World Forums

The peer to peer support community for media production professionals.

Activity Forums Adobe After Effects Expressions loopOut expression question

  • Dan Ebberts

    September 4, 2012 at 7:15 pm

    No, you can’t use loopOut() on paths. You can create your own though. Here are “roll your own” ping pong and cycle variations:


    // ping pong loopOut()

    if (numKeys > 1 && time > key(numKeys).time){
    t1 = key(1).time;
    t2 = key(numKeys).time;
    span = t2 - t1;
    delta = time - t2;
    seg = Math.floor(delta/span);
    t = delta%span;
    valueAtTime((seg%2) ? (t1 + t) : (t2 - t));
    }else
    value

    // cycle loopOut()

    if (numKeys > 1 && time > key(numKeys).time){
    t1 = key(1).time;
    t2 = key(numKeys).time;
    span = t2 - t1;
    delta = time - t2;
    seg = Math.floor(delta/span);
    t = delta%span;
    valueAtTime(t1 + t);
    }else
    value

    Dan

  • Patrick Birks

    October 16, 2012 at 11:21 pm

    Thanks Dan! I guess i’ve got a few questions now. Where can I go to figure out what that means because I have no idea what that is. Two how can that be changed so the loops happens later in the time line. For example I have a pulse of light that goes down a track it starts at 4 sec in last for 20 frames, how can i get it to not loop till another 4 seconds later. Hopefully that makes sense.

  • Dan Ebberts

    October 17, 2012 at 7:18 pm

    I’m not sure if this will do what you want, but this modification will loop the number of keyframes specified by variable n:


    n = 2;
    if (numKeys >= n && time > key(numKeys).time){
    t1 = key(numKeys-n+1).time;
    t2 = key(numKeys).time;
    span = t2 - t1;
    delta = time - t2;
    seg = Math.floor(delta/span);
    t = delta%span;
    valueAtTime(t1 + t);
    }else
    value

    The way I have it set up here, it will only loop the last two keyframes. Does that help?

    Dan

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