Creative Communities of the World Forums

The peer to peer support community for media production professionals.

Activity Forums Adobe After Effects Expressions AE CC 2014.1.1 Random divid by zero error in expression?

  • AE CC 2014.1.1 Random divid by zero error in expression?

    Posted by Bryan Woods on October 19, 2014 at 7:02 pm

    Has anyone come across this? I’ve been using this intertial bounce script by Dan for years now with no issues, but today using a new version of AE, when I apply the intertial bounce expression to a parameter and then scrub in the timeline a little, I suddenly get an error message stating “An error at line 16, (divide by zero?)”

    I’ve never seen this error before, but it happens randomly as I scrub through the timeline, and it immediately disables the expression. Anyone know whats going on? I’m working on a project last minute over the weekend and this is really screwing me over right now. Any help on this would be greatly appreciated.

    Below is the script i’ve been using:

    amp = .1;
    freq = 2.0;
    decay = 8.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); \\This is line 16 where the error is
    }else{value}

    Dan Ebberts replied 11 years, 9 months ago 2 Members · 3 Replies
  • 3 Replies
  • Dan Ebberts

    October 19, 2014 at 7:29 pm

    Try changing this line:

    if (n > 0){

    to this:

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

    Dan

  • Bryan Woods

    October 19, 2014 at 9:16 pm

    Things seem to be stable with this fix. Thanks Dan!

    Any idea why this was happening? I’m guessing something may have changed internally with javascript with the new AE update?

  • Dan Ebberts

    October 19, 2014 at 9:40 pm

    My guess is that your comp is longer than usual which caused Math.exp() to overflow.

    Edit: Could also be caused by higher decay value than ususal.

    Dan

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