Creative Communities of the World Forums

The peer to peer support community for media production professionals.

Activity Forums Adobe After Effects Expressions Inertia Bounce Decay issue

  • Inertia Bounce Decay issue

    Posted by Brad Pickford on August 3, 2015 at 4:11 pm

    Hi all,
    I have been using this expression for years but I have only just stumbled on tis issue. I have an object swinging and as it hits the last keyframe I want it to sway for while (more than one second). When I change the decay value it clips at 1 second from last keyframe. I have included a screenshot of the graph editor where you can see how it stops. Is there a way of changing the expression so that it can decay over periods greater than 1 second?

    Cheers!

    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 && t < 1){
    v = velocityAtTime(key(n).time - thisComp.frameDuration/10);
    value + v*amp*Math.sin(freq*t*2*Math.PI)/Math.exp(decay*t);
    }else{value}

    Jp Pelc replied 9 years, 3 months ago 3 Members · 3 Replies
  • 3 Replies
  • Dan Ebberts

    August 3, 2015 at 4:32 pm

    Try changing this line:

    if (n > 0 && t < 1){

    to this:

    if (n > 0 && t < 15){

    Dan

  • Brad Pickford

    August 4, 2015 at 12:03 am

    As always, PERFECT! Thanks so much Dan!

  • Jp Pelc

    January 24, 2017 at 9:24 pm

    Dan you are a true hero

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