-
Inertia expression keeps turning itself off
Hi there
I’m working on a big project at the moment and I’m using this inertia (bounce) expression on lots of elements. It’s an expression I found online at the Motion Graphics Exchange website.
When the expression works, it works a treat but it constantly turns off and throws the following error:
After Effects warning: invalid numeric result (divide by zero?)
Expression disabled.If anyone can help out here, I’d really, really, really appreciate it as it’s becoming quite painful and the deadline looms.
Thanks in advance 🙂
Mike
// Inertial Bounce (moves settle into place after bouncing around a little)
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);
amp = .03;
freq = 1;
decay = 15;
value + v*amp*Math.sin(freq*t*2*Math.PI)/Math.exp(decay*t);
}else{
value;
}miketosetto dot com | bestiacollective dot com