ADOBE AFTER EFFECTS: Forum Expressions Tutorials Creative Cloud

random movement within a shape of a shapelayer

COW Forums : Adobe After Effects Expressions

<< PREVIOUS   •   FAQ   •   VIEW ALL   •   PRINT   •   NEXT >>
Baba Luba
random movement within a shape of a shapelayer
on May 2, 2019 at 11:32:30 pm
Last Edited By Baba Luba on May 2, 2019 at 11:35:57 pm

Hi!

I want to move some small icons within the boundaries of a ShapeLayer a rectangular shape will do.
I want so move and scale this shape, so the parts within move with it.
Not from border to border, more like a wiggle random movment, but in a specific area. It would be cool to also control the "wiggle" parameters (speed and how far before direction change - easing would be cool too).

i found this: http://www.aecheatsheet.com/quick-tutorials/bounding-box-with-clamp

but the movement is too fast and not really controlable

any ideas?
thanks in advance!


Return to posts index

Filip Vandueren
Re: random movement within a shape of a shapelayer
on May 3, 2019 at 5:30:27 pm

Maybe something like this expression.
It uses noise() to produce wiggle-like values, and then maps these within the shape, including scale, position, and rotation.
Mind: the contained layers ar wiggling and spread out according to avaliable space, almost as if parented to the shape.
It doesn't "push" against the particles when the "cage" moves, nor do they bounce off the wall, etc…

If you need that behaviour, it would be more like programming a particle system which expressions are capable of, but very slow at.

wiggleSpeed=1;
margin = 25;

l = thisComp.layer("Shape Layer 1");
sr = l.sourceRectAtTime();

seedRandom(index,true);
randomX = linear(noise(wiggleSpeed*time+random(999999)), -1,1,sr.left+margin, sr.left+sr.width-margin);
randomY = linear(noise(wiggleSpeed*time+random(999999)), -1,1,sr.top+margin, sr.top+sr.height-margin);

l.toComp([randomX,randomY]);




Return to posts index

<< PREVIOUS   •   VIEW ALL   •   PRINT   •   NEXT >>
© 2019 CreativeCOW.net All Rights Reserved
[TOP]