Creative Communities of the World Forums

The peer to peer support community for media production professionals.

Activity Forums Adobe After Effects Expressions elastic and bounce expressions

  • Filip Vandueren

    December 12, 2007 at 1:33 am

    The basic formula for 2d position springiness is this:

    inertia = 0.95;
    k= 0.10;

    start=position;
    will=[0,0];

    for (j=0; j<=time; j+=thisComp.frameDuration) { target=thisComp.layer("ball 2").position.valueAtTime(j); diff = (target-start); will = [will[0]*inertia + diff[0]*k , will[1]*inertia + diff[1]*k] start += will; } start; Dan has a different one on his site, that allows for having the spring to have a certain length when rested: https://www.motionscript.com/design-guide/elastic.html

  • Thomas Passow

    January 18, 2008 at 1:33 am

    Thanks Filip! by splitting my layer, I was able to get the action of the bounce to look quite good with your expression.

  • Andy Engelkemier

    February 6, 2012 at 4:51 pm

    I was looking for this, but I knew there was something I was missing. Although this post works, this might be a little better if it works for your use (I know this is old, but it might help people like myself find what they need):

    https://www.motion-graphics-exchange.com/after-effects/Wiggle-rubber-bounce-throw-inertia-expressions/4ad0f32a944ad

    The script stops analyzing all previous frames once the bounce stops.

    Here’s the code (apply it directly to the layer you’re animation).
    // 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){
    v = velocityAtTime(key(n).time - thisComp.frameDuration/10);
    amp = .05;
    freq = 4.0;
    decay = 2.0;
    value + v*amp*Math.sin(freq*t*2*Math.PI)/Math.exp(decay*t);
    }else{
    value;
    }

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