Creative Communities of the World Forums

The peer to peer support community for media production professionals.

Activity Forums Adobe After Effects Expressions Keyframe Overshoot with no oscillation

  • Keyframe Overshoot with no oscillation

    Posted by Andres Torres on September 16, 2012 at 8:49 pm

    I’d like to create an expression similar to your Keyframe Overshoot example except I’d like the object to overshoot the position and ease into a stop with no oscillation. Possible variables could be mass and friction to control the ease to stop motion.

    Thanks.

    freq = 3;
    decay = 5;

    n = 0;
    if (numKeys > 0){
    n = nearestKey(time).index;
    if (key(n).time > time) n--;
    }
    if (n > 0){
    t = time - key(n).time;
    amp = velocityAtTime(key(n).time - .001);
    w = freq*Math.PI*2;
    value + amp*Math.sin((t)*w)/Math.exp(decay*(t))/w;
    }else
    value

    Dan Ebberts replied 13 years, 10 months ago 2 Members · 3 Replies
  • 3 Replies
  • Dan Ebberts

    September 16, 2012 at 9:27 pm

    You should be able to get rid of the oscillation by bumping up the damping (decay). Try freq = 1 and decay = 15 and see if that gets you closer.

    Dan

  • Andres Torres

    September 16, 2012 at 10:16 pm

    I keep getting this error with the expression when I change the freq and decay values.

    invalid numeric result (divide by zero?)

    Error occuredat line 13
    Property: ‘Position’

    I tried your suggested values and the position always returns to the last keyframed value. I’m looking to go past the keyframe and ease to a stop based on velocity and a friction variable.

    Thanks.

  • Dan Ebberts

    September 16, 2012 at 10:23 pm

    It would help if you would paste in the expression that’s generating the error.

    Dan

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