Creative Communities of the World Forums

The peer to peer support community for media production professionals.

Activity Forums Adobe After Effects Expressions Inertial Bounce expressions suddenly not working!

  • Inertial Bounce expressions suddenly not working!

    Posted by Michael Chappell on August 15, 2013 at 8:37 pm

    Can anyone tell me why this started happening in CS6? This expression always worked before.

    One theory was that the comp was too long (18 minutes). I have this in a 3 minute comp now and still get the same error. (I have used this expression in 2-3 minute comps before and not had issues.)

    Also received this reply:

    Not sure how to implement that, though.

    Also, the expression doesn’t break right away. It works for about 30 seconds before throwing an error.

    Here’s a link to the comp: https://www.dropbox.com/s/6nktob8yj8uohoi/007%20Sample%20Comp.aep

    Thanks!
    Mike

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

    Roger Maus replied 12 years, 5 months ago 4 Members · 7 Replies
  • 7 Replies
  • Dan Ebberts

    August 15, 2013 at 9:39 pm

    Try it this way:


    decay = 6.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);
    if (t < 2)
    value + v*amp*Math.sin(freq*t*2*Math.PI)/Math.exp(decay*t)
    else
    value;
    }else{value}

    Dan

  • Michael Chappell

    August 15, 2013 at 10:52 pm

    That did it!

    Thanks so much, Dan!

    Best,
    Mike

  • Ridley Walker

    August 16, 2013 at 12:57 am

    @Dan;

    Could you elaborate on the issue with the original expression and how replacement you graciously provided solves the problem?

  • Dan Ebberts

    August 16, 2013 at 1:14 am

    After a couple of minutes or so, Math.exp(decay*t) will become such a huge number that JavaScript represents it as “Infinity”, which I’m guessing breaks the division operation. I just limited the calculation to a couple of seconds, which is all it really needs for the decay to finish.

    Dan

  • Roger Maus

    November 25, 2013 at 10:35 am

    Hi there,

    sorry for picking over these bones, but
    what could be the reason if the bouncing aborts – like in my case?

    I applied the expression to the position property.
    amp = 0.1
    freq = 1.0
    decay = 2.2

  • Dan Ebberts

    November 25, 2013 at 2:34 pm

    It looks like you’re using the version of the expression that cuts off after a couple of seconds to keep from generating a divide by zero error. You could go back, to the original expression, or increase the cut off from 2 to 10 or so, or use this version, which I like better:

    https://www.motionscript.com/articles/bounce-and-overshoot.html#kf-overshoot

    Dan

  • Roger Maus

    November 25, 2013 at 5:25 pm

    Overshoot works perfectly fine. But if anyone else wants to stick to the “old” bounce expression, this is the way:
    amp = .1;
    freq = 1.5;
    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 && t < 2){ //----INCREASE LATTER VALUE IF CUT OFF----//
    v = velocityAtTime(key(n).time - thisComp.frameDuration/10);
    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