Creative Communities of the World Forums

The peer to peer support community for media production professionals.

Activity Forums Adobe After Effects Expressions Combining Inertial bounce and loopout cycle

  • Combining Inertial bounce and loopout cycle

    Posted by Esteban Bustos on November 22, 2014 at 4:33 pm

    Hi im trying to combine this two expressions to animate a character. here is how i try to combine them

    Expression:

    I= // Inertial Bounce (moves settle into place after bouncing around a little)
    n = 0;
    if (numKeys > 0){
    n = nearestKey(time).index;
    if (key(n).time > time){
    n–;
    }
    }
    if (n == 0){
    t = 0;
    }else{
    t = time – key(n).time;
    }

    if (n > 0 && t < 1){
    v = velocityAtTime(key(n).time – thisComp.frameDuration/10);
    amp = .05;
    freq = 2.0;
    decay = 6.0;
    value + v*amp*Math.sin(freq*t*2*Math.PI)/Math.exp(decay*t);
    }else{
    value;
    };

    L= loopOut(type = “cycle”, numKeyframes = 0);

    I + L – value;

    But it doesnt work, i need the bounce and the loop but i cant get it right.

    here is a link of what im trying to achieve:

    i would like the position to loop and the rotation to loop and bounce. The character is parent to a null which will move it foward.

    https://youtu.be/vsi2VMT3Myk

    Thanks in advance

    I= // Inertial Bounce (moves settle into place after bouncing around a little)
    n = 0;
    if (numKeys > 0){
    n = nearestKey(time).index;
    if (key(n).time > time){
    n--;
    }
    }
    if (n == 0){
    t = 0;
    }else{
    t = time - key(n).time;
    }

    if (n > 0 && t &lt; 1){
    v = velocityAtTime(key(n).time - thisComp.frameDuration/10);
    amp = .05;
    freq = 2.0;
    decay = 6.0;
    value + v*amp*Math.sin(freq*t*2*Math.PI)/Math.exp(decay*t);
    }else{
    value;
    };

    L= loopOut(type = "cycle", numKeyframes = 0);

    I + L - value;

    Kevin Camp replied 11 years, 8 months ago 3 Members · 2 Replies
  • 2 Replies
  • Dan Ebberts

    November 22, 2014 at 6:10 pm

    I don’t think you’ll be able to use loopOut() for this. You could rig your own version of it, but you have to define how long the loop should be, including enough time for the bounce to settle out. Then you just divide time into chunks of that length using the % (modulus( operator. For example,

    t0 = time % 1;

    t0 gives you a time value with a one-second loop, ramping from 0 to 1, then repeating continuously.

    Dan

  • Kevin Camp

    November 22, 2014 at 10:42 pm

    if you have the bounce workiing the way you need it, can you just convert that expression to keyframes and then use a loopOut() expression to loop through those keyframes?

    you’d need to remove a lot of the redundant keyframes produced by converting the expression to keyframes, but it may work for you…

    Kevin Camp
    Art Director
    KCPQ, KZJO & KRCW

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