Creative Communities of the World Forums

The peer to peer support community for media production professionals.

Activity Forums Adobe After Effects Expressions Wiggle range whole numbers

  • Wiggle range whole numbers

    Posted by Jason Jantzen on December 1, 2016 at 12:08 am

    I edited this expression from Dan Ebbert’s random motion post, but can’t figure out how to get whole number values.

    segMin = .1; //minimum segment duration
    segMax = .3; //maximum segment duration
    minVal = 1;
    maxVal = 5;

    end = 0;
    j = 0;
    while ( time >= end){
    j += 1;
    seedRandom(j,true);
    start = end;
    end += random(segMin,segMax);
    }
    endVal = random(minVal,maxVal);
    seedRandom(j-1,true);
    dummy=random(); //this is a throw-away value
    startVal = random(minVal,maxVal);

    Jason Jantzen
    vimeo.com/jasonj

    Morgan Mendieta replied 5 years, 11 months ago 3 Members · 3 Replies
  • 3 Replies
  • Dan Ebberts

    December 1, 2016 at 12:28 am

    Try this:


    segMin = .1; //minimum segment duration
    segMax = .3; //maximum segment duration
    minVal = 1;
    maxVal = 5;

    end = 0;
    j = 0;
    while ( time >= end){
    j += 1;
    seedRandom(j,true);
    start = end;
    end += random(segMin,segMax);
    }
    endVal = Math.floor(random(minVal,maxVal+1));
    seedRandom(j-1,true);
    dummy=random(); //this is a throw-away value
    startVal = Math.floor(random(minVal,maxVal+1));

    Dan

  • Jason Jantzen

    December 1, 2016 at 12:32 am

    Thanks Dan! I tried inserting Math.floor in various places in the expression but I don’t understand the expression enough to modify it like that. This works perfectly 😀

    Jason Jantzen
    vimeo.com/jasonj

  • Morgan Mendieta

    June 1, 2020 at 3:23 pm

    this worked great. thank you.

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