From: "D" Received: from mail-qt1-f169.google.com ([209.85.160.169] verified) by media-motion.tv (CommuniGate Pro SMTP 6.1.0) with ESMTPS id 7494928 for AE-List@media-motion.tv; Mon, 20 Jan 2020 17:22:15 +0100 Received: by mail-qt1-f169.google.com with SMTP id w30so167115qtd.12 for ; Mon, 20 Jan 2020 08:22:15 -0800 (PST) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=gmail.com; s=20161025; h=mime-version:in-reply-to:references:from:date:message-id:subject:to; bh=jkl+ZK4h+kcL0QMXevcTFMxqj+03dkQhUG2cG7rlXm0=; b=SmbnLKR8rPeyL2KlmYR66A6defvInqCwJa8Cpk8Tn0cpFCiAa5pV5SIhwlIAXe/4tI lp/juA5+R/F/2k5suud5beNOhU1DXInUcV7NVAIzpUl9qJA2hdN4ZkoqZ5pzqNTVG6yD Iho65KGZa/IYfKTLMdY8r0AmcoQzj6GXTIxv151Vs/ZOqLe5lVytsqv3UGVo6y8hfkWE oz2Lk2vE69AJswjkdORaQ7ff6piNj797pK7aejlG0RdMy+q5K4xes/amFDBnG3uLrI5q pMCVrl0U8dfNAzs5Png9q2eCpg3+cDJ79kCK6Oe/5znzHbvbAO1o1qxz6x7Z+NwURwDJ im2w== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20161025; h=x-gm-message-state:mime-version:in-reply-to:references:from:date :message-id:subject:to; bh=jkl+ZK4h+kcL0QMXevcTFMxqj+03dkQhUG2cG7rlXm0=; b=dKeTDC9PSkSN1ei0Vhe6hT6NFtIrNf62mbA/TT0yXafmPk6IQG51+nAi+eLXxkHsSL 4qW7zV8+QxgFNCyQ+Ku2miUzJWT5Dl+p8U4tJG0VWY3xZTYOGWlXSdrf8s7bHHDDYYmt uYFrVeZpG440qi3awghMzrEqkbY62FXYlf5SApnE5KgOMX0FwANvUCvB9XMkJBMDgQvP Nm11ZFXt62ZkCJ50EGKrz2YjSakG6F+qc/wYqexCllJTQXsBfiStKCdeiXSPSAzXVtFw ooqKnakat8nK++0sK70tEuiG+opGiTfa8IZ4nOHR38kXN+O+e4+T/MT0vW4HY62MJzeA 7VCA== X-Gm-Message-State: APjAAAXX2cdWHS01a1Ljp9FZhzw626YpfNggtVFInePg3OLwGgTm2vLb MhjEzNAvYGY5/rXkl2c0dI8nAH0xU4lNDIs1xKtEmp6Y X-Google-Smtp-Source: APXvYqym1OkH2QaQpTpl+SS7UvdyN/gBCywLET1RNKD3sbrwq+HvXxj71yc5/8zwwje5QHd2XkMrtBLgZmNpM6T0CZw= X-Received: by 2002:ac8:7699:: with SMTP id g25mr44803qtr.75.1579537334161; Mon, 20 Jan 2020 08:22:14 -0800 (PST) MIME-Version: 1.0 Received: by 2002:ac8:fee:0:0:0:0:0 with HTTP; Mon, 20 Jan 2020 08:22:13 -0800 (PST) In-Reply-To: References: Date: Mon, 20 Jan 2020 16:22:13 +0000 Message-ID: Subject: Re: [AE] Repelling layers To: After Effects Mail List Content-Type: multipart/alternative; boundary="000000000000b65544059c94b168" --000000000000b65544059c94b168 Content-Type: text/plain; charset="UTF-8" Content-Transfer-Encoding: quoted-printable =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 other too? (i=E2=80=99m not asking you to do it, I=E2=80=99m just interested whet= her 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 Away 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. --000000000000b65544059c94b168 Content-Type: text/html; charset="UTF-8" Content-Transfer-Encoding: quoted-printable =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 <dow.hanson@gmail.com> = wrote:
> Excellent Nathan.
>
> Is it possible with expres= sions 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 wi= th expressions).
>
> Thanks.
>
> On Thursday, 16 Ja= nuary 2020, Cary Spenser <AE-= List@media-motion.tv> wrote:
>> Nathan -
>> Really= helpful to rocket my understanding of scripting.=C2=A0
>> Thanks!=
>> Cary
>> On Wed, Jan 15, 2020 at 1:15 PM Nathan Shiple= y <AE-List@media-motion.tv> wrote:
>>
>> Henry,
>> Here's somethin= g really basic I just whipped up that simply moves layers away from a null.= =C2=A0 It just pushes objects=C2=A0away from where the null is when they= 9;re closer than the "Distance Threshold" control.=C2=A0 You can = increase the amount that they move with "Move Away Multiplier.">> Just paste the position expression from one of the solids to you= r own layers and it should work or at least be a starting point to tinker f= urther.=C2=A0 Expression pasted below as well:
>> Here's a qui= ck screencapture showing what it does:
>>
https://www.dropbo= x.com/s/97yymslvdmjgeez/MoveAwayDemo_01.mp4?dl=3D0
>>
>&= gt; And here's the .AEP:
>> https://www.dropbox= .com/s/8g3scef520fir3r/MoveAwayExpression_NS_01.aep?dl=3D0
>><= br>>> Not fancy but maybe helpful?
>> =C2=A0- Nathan
>= > p =3D transform.position;
>> nullPos =3D thisComp.layer("= ;Parent And Controls").transform.position;
>> distanceThresho= ld =3D thisComp.layer("Parent And Controls").effect("Distanc= e Threshold")("Slider");
>> moveAwayMult =3D thisCo= mp.layer("Parent And Controls").effect("Move Away Muliplier&= quot;)("Slider");
>>
>> distance =3D length(p, = nullPos);
>>
>> if (distance < distanceThreshold) {>> =C2=A0 =C2=A0 distanceMult =3D (Math.log(distanceThreshold / dist= ance)) * moveAwayMult;
>> =C2=A0 =C2=A0 delta =3D nullPos - p;
= >> =C2=A0 =C2=A0 nDelta =3D (normalize(delta));
>> =C2=A0 = =C2=A0 newPos =3D p - nDelta * distanceMult;
>> } else {
>&g= t; =C2=A0 =C2=A0 p
>> }
>>
>> On Wed, Jan 15, 20= 20 at 9:13 AM henry birdseye <AE-List@media-motion.tv> wrote:
>>
>> This is tru= e. --000000000000b65544059c94b168--