Return-Path: Received: from mail-wi0-f170.google.com ([209.85.212.170] verified) by media-motion.tv (CommuniGate Pro SMTP 4.2.10) with ESMTP-TLS id 5229393 for AE-List@media-motion.tv; Thu, 26 Sep 2013 17:10:11 +0200 Received: by mail-wi0-f170.google.com with SMTP id cb5so6902260wib.3 for ; Thu, 26 Sep 2013 08:10:25 -0700 (PDT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=gmail.com; s=20120113; h=mime-version:in-reply-to:references:date:message-id:subject:from:to :content-type; bh=HtAJ9+nPWqAxTo4jTPXZs6wG9qVQUvKjl+SG/8x7KY0=; b=GTuXPzbMk/vnU5TGy0MhpLzFNrhXUUWr1rqZ3AgtPy8ar3YlqeCKic8dV54LF8X51T 5zBjGL79r2hY/08OqfZBQd7nyaCTWgaaAJUwfG4cO48XCvecnaF2GQhvi4Xw2+bX5+Mj uZuIIhScboTZQ7yUhLkAhGugviQ/uhXfFayXypZFDNEy8owsEER6vhVWmeH5hSJgSYc6 jvIsMj0Wy5xld8mAsjYHYw4mer+XOfYGKjHO8mU8z/JOziWmVa+8tek4FlEJV906yCic PUdqmZWmBnE8rRKaQpLsi/YQK6q35jpoMcUWJrNjS2BmObGbFMq/us83+MEmWyhbx0xY H4MQ== MIME-Version: 1.0 X-Received: by 10.180.73.113 with SMTP id k17mr14061749wiv.6.1380208225475; Thu, 26 Sep 2013 08:10:25 -0700 (PDT) Received: by 10.217.7.71 with HTTP; Thu, 26 Sep 2013 08:10:25 -0700 (PDT) In-Reply-To: References: Date: Thu, 26 Sep 2013 16:10:25 +0100 Message-ID: Subject: Re: [AE] Inertial bounce expression keeps being disabled randomly... From: D To: After Effects Mail List Content-Type: multipart/alternative; boundary=f46d043749cdfee20a04e74ac4e4 --f46d043749cdfee20a04e74ac4e4 Content-Type: text/plain; charset=ISO-8859-1 Thanks Dan - this has solved my issue! On 26 September 2013 04:17, Dan Ebberts wrote: > Limiting the value of t should solve the problem: > > t = Math.min(time - key(n).time,10); > > Dan > > ------------------------------ > *From: *"D" > *To: *"After Effects Mail List" > *Sent: *Wednesday, September 25, 2013 8:38:51 AM > *Subject: *Re: [AE] Inertial bounce expression keeps being disabled > randomly... > > > Line 12, same line as the other version of the expression (which was line > 10). > > > On 25 September 2013 16:34, Lloyd Alvarez wrote: > >> What line number are you getting the error on? >> >> >> On Wed, Sep 25, 2013 at 11:30 AM, D wrote: >> >>> Looks good. I'll try and persuade these guys to buy that script. Also, >>> I've just had more expression failures but still get the divide by zero >>> error when I try to paste your solution above. Is this a bug beyond the >>> expression? >>> >>> >>> On 25 September 2013 15:40, Lloyd Alvarez wrote: >>> >>>> You can use this to batch update all the expressions in your project: >>>> http://aescripts.com/pt_expressedit/ >>>> >>>> >>>> On Wed, Sep 25, 2013 at 9:46 AM, D wrote: >>>> >>>>> Yes, was guessing that. Too many instances to replace with an upcoming >>>>> deadline though so quick fixing with the aid of your script for now. >>>>> >>>>> >>>>> On 25 September 2013 14:35, Lloyd Alvarez wrote: >>>>> >>>>>> The expression will keep failing unless you account for that divide >>>>>> by zero error. >>>>>> >>>>>> >>>>>> On Wed, Sep 25, 2013 at 9:23 AM, D wrote: >>>>>> >>>>>>> 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 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 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. >>>>>>>>>> >>>>>>>>> >>>>>>>>> >>>>>>> >>>>>> >>>>> >>>> >>> >> > --f46d043749cdfee20a04e74ac4e4 Content-Type: text/html; charset=ISO-8859-1 Content-Transfer-Encoding: quoted-printable
Thanks Dan - this has solved my issue!=A0




On 26 September 2013 04:17, Dan Ebberts = <debberts@comc= ast.net> wrote:
Limiting the value of t should solve the problem:

=A0t =3D = Math.min(time - key(n).time,10);

Dan


From: "D" <dow.hanson@gmail.com>
To: "After Effects Mail List" <AE-List@media-motion.tv>
Sent: Wednesday, September 25, 2013 8:38:51 AM
Subject: Re= : [AE] Inertial bounce expression keeps being disabled randomly...


Line 12, same line as the other vers= ion of the expression (which was line 10).


On 25 Septemb= er 2013 16:34, Lloyd Alvarez <lists@aescripts.com> wrote:<= br>
What line number are you ge= tting the error on?


On Wed, Sep 25, 2013 at 11:30 AM, D <dow.hanson@gmail.com> wrote:
Looks good. I'll try an= d persuade these guys to buy that script. Also, I've just had more expr= ession failures but still get the divide by zero error when I try to paste = your solution above. Is this a bug beyond the expression?=A0


On 25 Septemb= er 2013 15:40, Lloyd Alvarez <lists@aescripts.com> wrote:<= br>
You can use this to batch update all the expressions in yo= ur project:=A0http://aescripts.com/pt_expressedit/


On Wed, Sep 25, 2013 at 9:46 AM, D <dow.hanson@gmail.com>= wrote:
Yes, was guessing that. Too many instances to replace with= an upcoming deadline though so quick fixing with the aid of your script fo= r now.=A0


On 25 September 2013 14:35, Lloyd Alvare= z <lists@aescripts.com> wrote:
The expression will keep fa= iling unless you account for that divide by zero error.


On Wed, = Sep 25, 2013 at 9:23 AM, D <dow.hanson@gmail.com> wrote:<= br>
Thanks Lloyd. Funnily enoug= h, I just found your script 'Activate Disabled Expressions'. I purg= ed all memory then applied the script. Emptying the memory seems to allow t= hem back on. Great script. Next time I get a mass disablement I'll try = your solution.


On 25 Septemb= er 2013 12:35, Lloyd Alvarez <lists@aescripts.com> wrote:<= br>
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;

<= /span>
You can protect against that in several ways but here&#= 39;s a quick cheeky way:

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 <dow.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.










--f46d043749cdfee20a04e74ac4e4--