ADOBE AFTER EFFECTS: Forum Expressions Tutorials Creative Cloud

a roaming rotating square

COW Forums : Adobe After Effects Expressions

<< PREVIOUS   •   FAQ   •   VIEW ALL   •   PRINT   •   NEXT >>
Simon Francois
a roaming rotating square
on Dec 5, 2017 at 10:21:07 pm

Hi all, and thanks in advance for your help. I'm trying to achieve soemthing but cannot find ways to crack it up.

What I would like to have is a square moving itself by rotating of 90° every second. The script I'm using for that is:
segDur = 1;
seed = Math.floor(time/segDur);
segStart = seed*segDur;
startVal = Math.round(random(1))*90;
endVal = Math.round(random(-1, 1))*90;
ease(time,segStart,segStart + (segDur/2), startVal, endVal);

So it can move either 90° left, or right, or stay still.

I want to add to that the fact that its anchor point is also randomly placed on any of its vertices every second, and thus its motion is more unpredictable. But then, I also want it to take into account its new position, and move in that fashion within the frame of the composition.

I'm not sure if this is clear, but here are examples of what I want to do (handmade animation made without expressions):

And what I could do so far:

Thanks a million for your help.

Return to posts index

<< PREVIOUS   •   VIEW ALL   •   PRINT   •   NEXT >>
© 2018 All Rights Reserved