From: "Nathan Shipley" Received: from mail-il1-f171.google.com ([209.85.166.171] verified) by media-motion.tv (CommuniGate Pro SMTP 6.1.0) with ESMTPS id 7494937 for AE-List@media-motion.tv; Mon, 20 Jan 2020 18:30:22 +0100 Received: by mail-il1-f171.google.com with SMTP id g12so152677ild.2 for ; Mon, 20 Jan 2020 09:30:22 -0800 (PST) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=gmail.com; s=20161025; h=mime-version:references:in-reply-to:from:date:message-id:subject:to; bh=QrCvfVqP03AHMht2PgK5aKwQiVC8o8aDyL/0weZL150=; b=K1ccfSQx/kqk6X4Q/rFMt87GYW4dpWVPWshCK9C+bmQ1beWgUPJq60Jpc2uPDXBE0L bwiAGjYIsXj1ihyAeHwTtmIRDyHX8vHM3GmUWJLIBEV0nT7ypDFafKAOzGHvLHPv8vjl 4ITSUVG5pIJtgW9Hd4BFDCkNNlRRnJRWx7Nza4CYSM0Jmp8teYJ38NbJW/JXW7CU8Rkl QnnH6gMgHp7p9x1EFS2M78PuJ8vPEkIx1WhldZuvoubrvnDVAACfNo/rY0XX73thekwP SaiaP6prujQFKiv0zpAXzvnYI33X6XKGEFapmpFA5EkKLqTezYii61RceJqhg1x8zbbk iwgQ== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20161025; h=x-gm-message-state:mime-version:references:in-reply-to:from:date :message-id:subject:to; bh=QrCvfVqP03AHMht2PgK5aKwQiVC8o8aDyL/0weZL150=; b=gszpqxhzGw3fuXnmmjDRjZFamFVDti/jFyvJF6jEqY6X05rqVzrUOsdDHyJweUJM43 mtL/iymp5fygig32I2Yb4zJi4r8v412QRKmQj8V1SzYGdV4kGWaGYoI9dfz+TbuZjYcq ggMXacEq2w+ITFYrU5VgyCJBMZGWGxZTx7NfDIOtzmAUEFfvM2SNB36Kkwj6aomhMDcl GDdd33tdENX+bOX8LCSyZmthWFhwDyqh4ttkXWugxOMwKgwF+t+n1eNTw6dDjtZj4xcG YApDXYj/3UjDpZ5FZKqF11g0dEv4nsRzeHvkAKjmYVx/u1PPJbXwed1N2ybOMBELInf8 0YNQ== X-Gm-Message-State: APjAAAU6sG2W+RKDwLRAcbbdUrmWnVZpeJfuMphMCYmUenfw8IuPYhgL PUBcWv32EsebwAN2ZVnLvxVmPT+fW64qKcZCPyY+2g== X-Google-Smtp-Source: APXvYqxyo5MH4WzIrVTyUpWs8472PhVoIwx0HDEu32AycNrdQzBtXFX6TtDFWzoULo3o43k/SyQZGz2UKaJwF11d51A= X-Received: by 2002:a92:af08:: with SMTP id n8mr102095ili.217.1579541420595; Mon, 20 Jan 2020 09:30:20 -0800 (PST) MIME-Version: 1.0 References: In-Reply-To: Date: Mon, 20 Jan 2020 09:30:08 -0800 Message-ID: Subject: Re: [AE] Repelling layers To: After Effects Mail List Content-Type: multipart/alternative; boundary="000000000000486148059c95a595" --000000000000486148059c95a595 Content-Type: text/plain; charset="UTF-8" Content-Transfer-Encoding: quoted-printable At that point you=E2=80=99d probably want to just use something like the Ne= wton plugin which is built for this kinda stuff. It would be a bad use of expressions, get complicated, and probably bog down pretty quickly since expressions don=E2=80=99t have a =E2=80=9Cmemory=E2=80=9D as Dan Ebberts pu= ts it. That is to say, they only know what is going on in the current frame and you have to build in kinda slow workarounds to deal with this; there are no persistent variables, which you=E2=80=99d want to build a physics system. Good question though! On Mon, Jan 20, 2020 at 8:22 AM D wrote: > =E2=80=A6I should say 'make the grey blocks collide with each other=E2=80= =99 as opposed to > repel each other. > > On Monday, 20 January 2020, D wrote: > > Excellent Nathan. > > > > Is it possible with expressions to make the grey blocks repel each othe= r > too? (i=E2=80=99m not asking you to do it, I=E2=80=99m just interested wh= ether it=E2=80=99s > possible with expressions). > > > > Thanks. > > > > On Thursday, 16 January 2020, Cary Spenser > wrote: > >> Nathan - > >> Really helpful to rocket my understanding of scripting. > >> Thanks! > >> Cary > >> On Wed, Jan 15, 2020 at 1:15 PM Nathan Shipley > wrote: > >> > >> Henry, > >> Here's something really basic I just whipped up that simply moves > layers away from a null. It just pushes objects away from where the null > is when they're closer than the "Distance Threshold" control. You can > increase the amount that they move with "Move Away Multiplier." > >> Just paste the position expression from one of the solids to your own > layers and it should work or at least be a starting point to tinker > further. Expression pasted below as well: > >> Here's a quick screencapture showing what it does: > >> https://www.dropbox.com/s/97yymslvdmjgeez/MoveAwayDemo_01.mp4?dl=3D0 > >> > >> And here's the .AEP: > >> > https://www.dropbox.com/s/8g3scef520fir3r/MoveAwayExpression_NS_01.aep?dl= =3D0 > >> > >> Not fancy but maybe helpful? > >> - Nathan > >> p =3D transform.position; > >> nullPos =3D thisComp.layer("Parent And Controls").transform.position; > >> distanceThreshold =3D thisComp.layer("Parent And > Controls").effect("Distance Threshold")("Slider"); > >> moveAwayMult =3D thisComp.layer("Parent And Controls").effect("Move Aw= ay > Muliplier")("Slider"); > >> > >> distance =3D length(p, nullPos); > >> > >> if (distance < distanceThreshold) { > >> distanceMult =3D (Math.log(distanceThreshold / distance)) * > moveAwayMult; > >> delta =3D nullPos - p; > >> nDelta =3D (normalize(delta)); > >> newPos =3D p - nDelta * distanceMult; > >> } else { > >> p > >> } > >> > >> On Wed, Jan 15, 2020 at 9:13 AM henry birdseye > wrote: > >> > >> This is true. --000000000000486148059c95a595 Content-Type: text/html; charset="UTF-8" Content-Transfer-Encoding: quoted-printable
At that point you=E2=80=99d probably want to just us= e something like the Newton plugin which is built for this kinda stuff.=C2= =A0 It would be a bad use of expressions, get complicated, and probably bog= down pretty quickly since expressions don=E2=80=99t have a =E2=80=9Cmemory= =E2=80=9D as Dan Ebberts puts it.=C2=A0 That is to say, they only know what= is going on in the current frame and you have to build in kinda slow worka= rounds to deal with this; there are no persistent variables, which you=E2= =80=99d want to build a physics system.=C2=A0

Good question though!

On Mon, Jan 20, 2= 020 at 8:22 AM D <AE-List@med= ia-motion.tv> wrote:
=E2=80= =A6I should say 'make the grey blocks collide with each other=E2=80=99 = as opposed to repel each other.

On Monday, 20 January 2020, D <<= a href=3D"mailto:dow.hanson@gmail.com" target=3D"_blank">dow.hanson@gmail.c= om> wrote:
> Excellent Nathan.
>
> Is it possible = with expressions to make the grey blocks repel each other too? (i=E2=80=99m= not asking you to do it, I=E2=80=99m just interested whether it=E2=80=99s = possible with expressions).
>
> Thanks.
>
> On Thur= sday, 16 January 2020, Cary Spenser <AE-List@media-motion.tv> wrote:
>>= ; Nathan -
>> Really helpful to rocket my understanding of scripti= ng.=C2=A0
>> Thanks!
>> Cary
>> On Wed, Jan 15, = 2020 at 1:15 PM Nathan Shipley <AE-List@media-motion.tv> wrote:
>>
= >> Henry,
>> Here's something really basic I just whippe= d up that simply moves layers away from a null.=C2=A0 It just pushes object= s=C2=A0away from where the null is when they're closer than the "D= istance Threshold" control.=C2=A0 You can increase the amount that the= y move with "Move Away Multiplier."
>> Just paste the po= sition expression from one of the solids to your own layers and it should w= ork or at least be a starting point to tinker further.=C2=A0 Expression pas= ted below as well:
>> Here's a quick screencapture showing wha= t it does:
>> https://www.dropbox.com/s/97= yymslvdmjgeez/MoveAwayDemo_01.mp4?dl=3D0
>>
>> And he= re's the .AEP:
>> https://www= .dropbox.com/s/8g3scef520fir3r/MoveAwayExpression_NS_01.aep?dl=3D0
&= gt;>
>> Not fancy but maybe helpful?
>> =C2=A0- Nathan=
>> p =3D transform.position;
>> nullPos =3D thisComp.lay= er("Parent And Controls").transform.position;
>> distanc= eThreshold =3D thisComp.layer("Parent And Controls").effect("= ;Distance Threshold")("Slider");
>> moveAwayMult = =3D thisComp.layer("Parent And Controls").effect("Move Away = Muliplier")("Slider");
>>
>> distance =3D = length(p, nullPos);
>>
>> if (distance < distanceThres= hold) {
>> =C2=A0 =C2=A0 distanceMult =3D (Math.log(distanceThresh= old / distance)) * moveAwayMult;
>> =C2=A0 =C2=A0 delta =3D nullPo= s - p;
>> =C2=A0 =C2=A0 nDelta =3D (normalize(delta));
>>= =C2=A0 =C2=A0 newPos =3D p - nDelta * distanceMult;
>> } else {>> =C2=A0 =C2=A0 p
>> }
>>
>> On Wed, Ja= n 15, 2020 at 9:13 AM henry birdseye <AE-List@media-motion.tv> wrote:
>&g= t;
>> This is true.
--000000000000486148059c95a595--