FORUMS: list search recent posts

random expression using only 3 possible values

COW Forums : Adobe After Effects Expressions

<< PREVIOUS   •   FAQ   •   VIEW ALL   •   PRINT   •   NEXT >>
Nick Kirastoulis
random expression using only 3 possible values
on Oct 27, 2011 at 7:01:57 am

Hey everyone, I need help with a certain kind of expression. I was wondering how to get a set of specific numbers to alternate randomly over time. For example: the values 90, 180, 270 will randomly alternate and be active for a random ammount of time.

Any help is greatly appreciated.


Return to posts index

Dan Ebberts
Re: random expression using only 3 possible values
on Oct 27, 2011 at 3:03:03 pm

Play around with this:


segMin = .5;
segMax = 1.0;
val = [90,180,270];
tPrev = 0;
tCurr = 0;
seg = 0;
seedRandom(index,true);
while (tCurr <= time){
tPrev = tCurr;
tCurr += random(segMin,segMax);
seg++;
}
seedRandom(seg,true);
val[Math.floor(random(val.length))]



Dan



Return to posts index

Nick Kirastoulis
Re: random expression using only 3 possible values
on Oct 30, 2011 at 4:03:38 am

Oh wow, thank you very much! that's exactly what i needed.


Return to posts index

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