Creative Communities of the World Forums

The peer to peer support community for media production professionals.

Activity Forums Adobe After Effects Expressions Dan’s random motion round to whole numbers

  • Dan’s random motion round to whole numbers

    Posted by Jason Jantzen on July 6, 2016 at 3:31 am

    Hey Dan,

    I use your random expressions from your site a lot. Tonight I plugged this into a repeater and can’t figure out how to include math.floor(value) in the mix to make whole numbers. Could you help me sort that out and explain why adding it to the bottom of the stack nullifies the whole expression? Thank you, sir!

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

    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);
    ease(time,start,end,startVal,endVal)

    Jason Jantzen
    vimeo.com/jasonj

    Jason Jantzen replied 9 years, 10 months ago 2 Members · 2 Replies
  • 2 Replies
  • Dan Ebberts

    July 6, 2016 at 6:11 am

    I’m not sure if this is what you’re after, but you could change the last line to this:

    Math.floor(ease(time,start,end,startVal,endVal))

    Dan

  • Jason Jantzen

    July 6, 2016 at 2:26 pm

    That did it! I see the previous line is still intact with parenthesis in it. One of these days, I’m sure expressions will begin to sink in 😀 Thanks Dan!

    Jason Jantzen
    vimeo.com/jasonj

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