ADOBE AFTER EFFECTS: Forum Expressions Tutorials Creative Cloud

Random position between 4 fixed values (X)

COW Forums : Adobe After Effects Expressions

<< PREVIOUS   •   FAQ   •   VIEW ALL   •   PRINT   •   NEXT >>
Ricardo Avila Ponce
Random position between 4 fixed values (X)
on Oct 8, 2019 at 11:34:07 pm

Hi, I need a script to randomly change an image position between 4 fixed positions only in X axis (Y remains the same always) Any idea please?


Return to posts index

Dan Ebberts
Re: Random position between 4 fixed values (X)
on Oct 9, 2019 at 12:29:19 am

You've a little sparse on details, but see if this gets you headed in the right direction:

xPos = [100,200,300,400];
period = 1; // change position every second
seed = Math.floor(time/period);
seedRandom(seed,true);
idx = Math.floor(random(xPos.length));
x = xPos[idx];
[x,value[1]]


Dan



Return to posts index

Ricardo Avila Ponce
Re: Random position between 4 fixed values (X)
on Oct 9, 2019 at 12:27:23 pm

Works like a charm!!!

Thank you very much Dan!


Return to posts index

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