Mailing List AE-List@media-motion.tv ? Message #50918
From: D <dow.hanson@gmail.com>
Subject: Re: [AE] Inertial bounce expression keeps being disabled randomly...
Date: Wed, 25 Sep 2013 14:23:24 +0100
To: After Effects Mail List <AE-List@media-motion.tv>
Thanks Lloyd. Funnily enough, I just found your script 'Activate Disabled Expressions'. I purged all memory then applied the script. Emptying the memory seems to allow them back on. Great script. Next time I get a mass disablement I'll try your solution.


On 25 September 2013 12:35, Lloyd Alvarez <lists@aescripts.com> wrote:
As the error suggests, it gets disabled because it tries to divide by zero.. Most probably because you are in negative time due to this: t = time - key(n).time;

You can protect against that in several ways but here's a quick cheeky way:

amp = .1;

freq = 2.0;

decay = 12.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);

d= Math.exp(decay*t);
if ( d == 0 ) d= 0.0001;

 value + v*amp*Math.sin(freq*t*2*Math.PI)/d;

}else{value}


Cheers,

Lloyd

On Wednesday, September 25, 2013, D wrote:
...confusingly, the expression will sometimes continue to work on other layers in the same comp on both position and scale parameters whilst some get disabled. 


On 25 September 2013 10:40, D <dow.hanson@gmail.com> wrote:
Hi

The expression I'm using looks like this:

amp = .1;

freq = 2.0;

decay = 12.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}


It works most of the time then will randomly get disabled across lots of layers and will not allow me to re-enable until I've restarted AE (v5.5). This is the error:


--


After Effects warning: invalid numeric result (divide by zero?)

Expression disabled.


Error occurred at line 10.

Comp: 'XXX'

Layer 17 ('XXX')

Property: 'Scale'


--


I have no real knowledge of how expression code works. I cut and paste when I use them. The project is 4 minutes long and the expression occurs across many comps and typically as the deadline approaches the error is now cropping up often. Any help appreciated.


Thanks.



 
Subscribe (FEED) Subscribe (DIGEST) Subscribe (INDEX) Unsubscribe Mail to ListMaster