Creative Communities of the World Forums

The peer to peer support community for media production professionals.

Activity Forums Adobe After Effects Expressions Loop out defined set of keyframes

  • Loop out defined set of keyframes

    Posted by Jason Jantzen on April 6, 2014 at 4:13 am

    Is there a way to loop just a set of keyframes, like maybe with markers or something? My basic set up has 3 keyframes and I’d like to loop out, but not include the first keyframe. Any ideas?

    Jason Jantzen
    vimeo.com/jasonj

    Anmol Mahendiratta replied 2 years ago 6 Members · 20 Replies
  • 20 Replies
  • Dan Ebberts

    April 6, 2014 at 5:53 am

    The second parameter of loopOut() controls how many keyframes get looped. This will loop the last two:

    loopOut(“cycle”,1)

    (the parameters specifies the number of keyframes in addition to the last one).

    Dan

  • Jason Jantzen

    April 7, 2014 at 2:42 pm

    Thanks Dan! So if I understand this correctly, “numberKeyframes” defines which keyframe is the looping point, or simply how many are looped? Because with a value of 1, I’m a little confused that it’s looping only 1 keyframe, since it’s looping after the 1st keyframe, but not including it. Is there a number 0 keyframe in consideration with AE?

    Jason Jantzen
    vimeo.com/jasonj

  • Dan Ebberts

    April 7, 2014 at 4:46 pm

    For loopOut(,)the count is the number of keyframes to be looped, counting backwards from the last keyframe, but the last keyframe is not included in that count (it is included in the loop though). So if you have 3 keyframes, loopOut(“cycle”,1) loops keyframes 2 and 3. It is a little confusing.

    Dan

  • Jason Jantzen

    April 7, 2014 at 5:51 pm

    Thanks Dan, that does help make sense of it.

    Jason Jantzen
    vimeo.com/jasonj

  • Anton Frolov

    December 3, 2016 at 5:18 am

    Hello Dan!
    But what if I need to loopOut(“cycle”,-2) (tried to joke in IT)
    I mean if I need the FIRST 3 keyframes to be looped until we reach the 4th keyframe (then goes the animation 5,6,7kf …)?

    Thanks!

    Also tried to stop the lO(); with markers and continue ->
    failed to insert reference to the property itself so it stops loopOut and reads the current Kframes. Only constant values work here =(
    =====
    stop = marker.key(marker.numKeys).time;
    loopDur = key(numKeys).time;
    if (time > stop){
    stop%loopDur;
    }else{
    loopOut();
    }

  • Dan Ebberts

    December 3, 2016 at 11:27 pm

    It’s hard to decipher exactly what you’re looking for, but it might be something like this:


    if (numKeys >= 7){
    if (time < key(1).time){
    t = time;
    }else if (time < key(4).time){
    t = key(1).time + (time - key(1).time)%(key(3).time - key(1).time);
    }else if (time < key(5).time){
    t = time;
    }else{
    t = key(5).time + (time - key(5).time)%(key(7).time - key(5).time);
    }
    valueAtTime(t);
    }else
    value

    It should loop keyframes 1 through 3 until it gets to keyframe 4, then when it gets to keyframe 5, it loops 5 through 7.
    Hopefully there’s enough there to get you headed in the right direction.

    Dan

  • Darby Edelen

    December 5, 2016 at 3:30 am

    I can’t decipher the expression you included, but based on your description it sounds to me like you just need:

    loopIn("cycle", 2);

    Darby Edelen

  • Cutter Johnston

    April 20, 2017 at 1:07 pm

    Dan,

    Thank you for still being around. Could you take a look at this? When I add loopOut(“cycle”,7) to the end of the existing expression below it becomes in active. How can I LoopOut the keyframes and keep the slider expressions intact?

    Thanks!

    Cutter

    a=wiggle(thisComp.layer("Slider Controls Body").effect("Pelvis X Amp")("Slider"),thisComp.layer("Slider Controls Body").effect("Pelvis X Movement")("Slider"));
    b=wiggle(thisComp.layer("Slider Controls Body").effect("Pelvis Y Amp")("Slider"),thisComp.layer("Slider Controls Body").effect("Pelvis Y Movement")("Slider"));
    [a[0],b[1]];

  • Dan Ebberts

    April 20, 2017 at 4:29 pm

    Are you just trying to add a wiggle to looped keyframes? Something like this might work:

    a=wiggle(thisComp.layer(“Slider Controls Body”).effect(“Pelvis X Amp”)(“Slider”),thisComp.layer(“Slider Controls Body”).effect(“Pelvis X Movement”)(“Slider”));
    b=wiggle(thisComp.layer(“Slider Controls Body”).effect(“Pelvis Y Amp”)(“Slider”),thisComp.layer(“Slider Controls Body”).effect(“Pelvis Y Movement”)(“Slider”));
    loopOut(“cycle”,7) + [a[0],b[1]] – value;

    Dan

  • Cutter Johnston

    April 20, 2017 at 9:57 pm

    Dan,

    Amazing…perfection.

    Thank you!

    Cutter

Page 1 of 3

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