ADOBE AFTER EFFECTS: Forum Expressions Tutorials Creative Cloud

Random movement in a single direction.

COW Forums : Adobe After Effects Expressions

<< PREVIOUS   •   FAQ   •   VIEW ALL   •   PRINT   •   NEXT >>
Colby Turybury
Random movement in a single direction.
on Jul 25, 2017 at 2:48:21 pm

I have a block of text that I need to move upward but I want the movement to be random. Go up 20 pixels here 50 pixels there 5 again. Something like that. however the trick is to get it to never go back go to a new spot then stop for a random number of frames.


Return to posts index

Dan Ebberts
Re: Random movement in a single direction.
on Jul 25, 2017 at 6:32:22 pm

Something like this maybe:


minDist = 5;
maxDist = 50;
minHold = 5; // frames
maxHold = 15;
seedRandom(index,true);

t0 = 0;
t1 = 0;
yTot = 0;

while (t1 < time){
t0 = t1;
t1 += random(framesToTime(minHold),framesToTime(maxHold));
if (t1 < time)
yTot += random(minDist,maxDist);
}
value - [0,yTot]



Dan



Return to posts index

Colby Turybury
Re: Random movement in a single direction.
on Jul 26, 2017 at 2:59:07 pm

This awesome!!! Thank you so much. I see that the block of text "steps" upward. How would you randomly make it move and smoothly and step upward? Could you also comment the script? I am a noob and am really needing to understand scripting.


Return to posts index

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