|
|
…I should say 'make the grey blocks collide with each other’ as opposed to repel each other.
On Monday, 20 January 2020, D <dow.hanson@gmail.com> wrote: > Excellent Nathan. > > Is it possible with expressions to make the grey blocks repel each other too? (i’m not asking you to do it, I’m just interested whether it’s possible with expressions). > > Thanks. > > On Thursday, 16 January 2020, Cary Spenser <AE-List@media-motion.tv> wrote: >> Nathan - >> Really helpful to rocket my understanding of scripting. >> 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 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=0 >> >> And here's the .AEP: >> https://www.dropbox.com/s/8g3scef520fir3r/MoveAwayExpression_NS_01.aep?dl=0 >> >> Not fancy but maybe helpful? >>  - Nathan >> p = transform.position; >> nullPos = thisComp.layer("Parent And Controls").transform.position; >> distanceThreshold = thisComp.layer("Parent And Controls").effect("Distance Threshold")("Slider"); >> moveAwayMult = thisComp.layer("Parent And Controls").effect("Move Away Muliplier")("Slider"); >> >> distance = length(p, nullPos); >> >> if (distance < distanceThreshold) { >>   distanceMult = (Math.log(distanceThreshold / distance)) * moveAwayMult; >>   delta = nullPos - p; >>   nDelta = (normalize(delta)); >>   newPos = p - nDelta * distanceMult; >> } else { >>   p >> } >> >> On Wed, Jan 15, 2020 at 9:13 AM henry birdseye <AE-List@media-motion.tv> wrote: >> >> This is true.
|
|