Creative Communities of the World Forums

The peer to peer support community for media production professionals.

Activity Forums Adobe After Effects Expressions Intertial Bounce combined with squash and stretch

  • Intertial Bounce combined with squash and stretch

    Posted by Ben Tillett on March 15, 2013 at 12:13 am

    Hi,

    I’m sure this has been answered before, but I’m struggling to find the solution either here on on google.

    I’m using Dan Ebbert’s/ Harry Frank’s “inertial bounce” expression on the scale property of my keyframed layer, but I’d like to modify it so that the layer “squashes and stretches” as it settles.

    I know Dan has a “squash and stretch” expression, but does anyone know how can I combine the two expressions to allow me squash and stretch on a key framed property?

    I’ve tried the expression below, but I get a “second argument to div() must be scalar” error, which clearly means I’m doing it wrong!!

    Thanks for any help

    amp = .1;
    freq = 2.0;
    decay = 2.0;
    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);
    x = scale[0] + + v*amp*Math.sin(freq*t*2*Math.PI)/Math.exp(decay*t);
    y = scale[0]*scale[1]/x;
    [x,y]
    }else{value}

    Ben Tillett replied 13 years, 2 months ago 2 Members · 2 Replies
  • 2 Replies
  • Dan Ebberts

    March 15, 2013 at 3:48 am

    This should work:


    amp = .1;
    freq = 2.0;
    decay = 2.0;
    n = 0;
    if (numKeys > 0){
    n = nearestKey(time).index;
    if (key(n).time > time)n--;
    }
    if (n > 0){
    t = time - key(n).time;
    v = velocityAtTime(key(n).time - thisComp.frameDuration/10);
    temp = value + v*amp*Math.sin(freq*t*2*Math.PI)/Math.exp(decay*t);
    x = temp[0];
    y = value[0]*value[1]/x;
    [x,y]
    }else
    value

    Dan

  • Ben Tillett

    March 15, 2013 at 8:55 am

    You da man, Dan! That works great, and I can kind of see where I went wrong.

    Thank you!

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