Creative Communities of the World Forums

The peer to peer support community for media production professionals.

Activity Forums Adobe After Effects Expressions Loop keyframes gains over time

  • Loop keyframes gains over time

    Posted by Gerald mark Soto on July 25, 2017 at 4:16 pm

    for example: I have a walk cycle of a character that bobs up and down between two keyframe as well as position move about 50 pixels to the left. Well I want that motion to loop again and again but at the same time move another 50 pixels every time it loops so it makes its way off screen. How would i go about creating a loop that gains over time? I have found an expression where you can choose which keyframes to loop and how many times, so i figured that would be a good start but how would i be able to have it gain every time it loops?

    if (numKeys > 1){
    nLoops = 5;
    t1 = key(1).time;
    t2 = key(2).time;

    if (time < t1)
    value
    else if (time < t1 + nLoops*(t2-t1))
    valueAtTime(t1 + (time - t1)%(t2-t1))
    else
    valueAtTime(t2 + time - (t1 + nLoops*(t2-t1)));
    }else
    value

    Gerald mark Soto replied 8 years, 9 months ago 2 Members · 6 Replies
  • 6 Replies
  • Dan Ebberts

    July 25, 2017 at 6:16 pm

    Have you tried loopOut(“offset”) ?

    Dan

  • Gerald mark Soto

    July 25, 2017 at 6:32 pm

    Oh damn, BOOM!. Done. Perfecto. Do you think there is a way to include it into the expression in the initial post? For example: having 4 keyframes and wanting the last 2 keyframes to loopOut(“offset”)?

  • Dan Ebberts

    July 25, 2017 at 6:40 pm

    As I recall, this should loop the last 2 keyframes:

    loopOut(“offset”,1);

    Dan

  • Gerald mark Soto

    July 25, 2017 at 6:49 pm

    Ding Ding Ding. Its like obvious-ville for you huh. Simplistic expressions sometimes just escape my grasp. Thanks Again. So to add on to this procedure how would i go about stopping the loop after 5 loops and maintain its last position of the loop?

    Once again thank you for you expedience and knowledge.

  • Dan Ebberts

    July 25, 2017 at 7:13 pm

    Hmm…

    I think that starts to look more like your original expression:


    nLoops = 5;

    t1 = key(numKeys-1).time;
    v1 = key(numKeys-1).value;
    t2 = key(numKeys).time;
    v2 = key(numKeys).value;
    if (time < t2 + nLoops*(t2-t1))
    loopOut("offset",1)
    else
    v2 + nLoops*(v2-v1)

    Dan

  • Gerald mark Soto

    July 25, 2017 at 7:30 pm

    Wamo! excellent. exactly what i needed. Thanks again señor.

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