Return-Path: Received: from [208.97.132.66] (HELO homiemail-a76.g.dreamhost.com) by media-motion.tv (CommuniGate Pro SMTP 4.2.10) with ESMTP id 5227878 for AE-List@media-motion.tv; Wed, 25 Sep 2013 13:35:23 +0200 Received: from homiemail-a76.g.dreamhost.com (localhost [127.0.0.1]) by homiemail-a76.g.dreamhost.com (Postfix) with ESMTP id DF10D458083 for ; Wed, 25 Sep 2013 04:35:34 -0700 (PDT) DKIM-Signature: v=1; a=rsa-sha1; c=relaxed; d=aescripts.com; h= mime-version:in-reply-to:references:date:message-id:subject:from :to:content-type; s=aescripts.com; bh=EQrNDy/l5axWo+gHh6HTNItJ7X M=; b=Rowr1juUHg3szbFHrp0kAILG84LwGg8YkDttpFux1DSb7zlNs9dNlLRcrV COpqTYMXg08RiBybJ+Qzo9fFgTydDGsgwys1nnHpasjzHWrFJxNuXGj6MVzgReSc eeZyz8fga0g8RNupuvAWao1QwfNvi6G3fqubEdVfMhWQryU2Q= Received: from mail-vc0-f176.google.com (mail-vc0-f176.google.com [209.85.220.176]) (using TLSv1 with cipher RC4-SHA (128/128 bits)) (No client certificate requested) (Authenticated sender: lists@aescripts.com) by homiemail-a76.g.dreamhost.com (Postfix) with ESMTPSA id A135A458080 for ; Wed, 25 Sep 2013 04:35:34 -0700 (PDT) Received: by mail-vc0-f176.google.com with SMTP id lf11so4174019vcb.21 for ; Wed, 25 Sep 2013 04:35:33 -0700 (PDT) X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20130820; h=mime-version:in-reply-to:references:date:message-id:subject:from:to :content-type; bh=gjrauqbX7H15FD2mbBB2P4TxfaWDZj6JxETFKTgofjM=; b=dMEtrRiWzf63Zi3hEhDv6c6nhbPkBMKfwqUFr3VX7L165/UfrkoJN5e6UkkA+zT374 szCsm5Y7qOg6b6t0QAw6ZzjgWWUsYnBXOHuaRptEcwpCQBPsWnN8qsGSzeCdkZZRu1+5 AA1XTk6b8+0aSeid4DTMvtK6NQ9fsS5PkxdQhqqrc/kkyJBlEydtw7UvueeOIUXt3ZNK 9BLnyxwFTd9euGIXNvi9LXNDxo1D3b5bQS6//vSAu/YfK2UL4NOx4IgG8eq/uykpG1WT clXM8RGDT0fewqCgHi4qPCWsNNfidiN+pydZvA6HvSwF1Rn8E/uVwlhfHqPOStWekF62 dhig== MIME-Version: 1.0 X-Received: by 10.220.186.202 with SMTP id ct10mr33166352vcb.14.1380108933764; Wed, 25 Sep 2013 04:35:33 -0700 (PDT) Received: by 10.220.193.2 with HTTP; Wed, 25 Sep 2013 04:35:33 -0700 (PDT) In-Reply-To: References: Date: Wed, 25 Sep 2013 07:35:33 -0400 Message-ID: Subject: Re: [AE] Inertial bounce expression keeps being disabled randomly... From: Lloyd Alvarez To: After Effects Mail List Content-Type: multipart/alternative; boundary=047d7b676fd0bfa13d04e733a6a1 --047d7b676fd0bfa13d04e733a6a1 Content-Type: text/plain; charset=ISO-8859-1 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 'cvml', '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. >> > > --047d7b676fd0bfa13d04e733a6a1 Content-Type: text/html; charset=ISO-8859-1 Content-Transfer-Encoding: quoted-printable 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:=A0t =3D time - key(n).time;

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

amp =3D .1;

freq = =3D 2.0;

decay =3D 12.0;

n= =3D 0;

if (numKeys > 0){ n =3D nearestKey(time).index;

if (key(n).time > time){ n--;

}} if (n =3D=3D 0){ t =3D 0;

}else{ t =3D time - key(n).time;

} if (n > 0){ v =3D velocityAtTime(key(n).time - thisComp.frameDuration/= 10);

d=3D=A0Math.exp= (decay*t);
if ( d =3D=3D 0 ) d=3D 0.0001;

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

}else{value}


Cheers,

<= /span>
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.=A0


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

The expression I'm using looks l= ike this:

amp =3D .1;

= freq =3D 2.0;

= decay =3D 12.0;

= n =3D 0;

= if (numKeys > 0){ n =3D nearestKey(time).index;

= if (key(n).time > time){ n--;

= }} if (n =3D=3D 0){ t =3D 0;

= }else{ t =3D time - key(n).time;

= } if (n > 0){ v =3D 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 la= yers 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?)

Expressi= on 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 erro= r is now cropping up often.=A0Any help appreciated.

=

Thanks.


--047d7b676fd0bfa13d04e733a6a1--