Creative Communities of the World Forums

The peer to peer support community for media production professionals.

Activity Forums Adobe After Effects Expressions random expression using only 3 possible values

  • random expression using only 3 possible values

    Posted by Nick Kirastoulis on October 27, 2011 at 7:01 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.

    Nick Kirastoulis replied 14 years, 6 months ago 2 Members · 2 Replies
  • 2 Replies
  • Dan Ebberts

    October 27, 2011 at 3: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

  • Nick Kirastoulis

    October 30, 2011 at 4:03 am

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

We use anonymous cookies to give you the best experience we can.
Our Privacy policy | GDPR Policy