Creative Communities of the World Forums

The peer to peer support community for media production professionals.

Activity Forums Adobe After Effects Expressions How to randomize timing for random scale expression

  • How to randomize timing for random scale expression

    Posted by Chris Cameron on August 24, 2016 at 1:09 pm

    Hi All,
    I found the below expression provided by Dan on a much older thread which worked like a charm. Now I would like to figure out how to specify a random frame range as opposed to the scale change happening at regular frame intervals. Thanks!

    frame = Math.round(time/thisComp.frameDuration);
    seed = Math.floor(frame/3);
    seedRandom(seed,true);
    s = random(50,150);
    [s,s]

    Chris Cameron replied 9 years, 8 months ago 2 Members · 4 Replies
  • 4 Replies
  • Dan Ebberts

    August 24, 2016 at 1:27 pm

    Like this maybe:

    frame = Math.round(time/thisComp.frameDuration);
    seed = Math.floor(frame/3);
    seedRandom(seed,true);
    f = Math.floor(random(0,timeToFrames(thisComp.duration)));
    framesToTime(f)

    Dan

  • Chris Cameron

    August 24, 2016 at 2:49 pm

    Thanks Dan, unfortunately I can’t get that to work…

    This is the original expression I’m working with to change the scale every 15 frames:

    frame = Math.round(time/thisComp.frameDuration);
    seed = Math.floor(frame/15);
    seedRandom(seed,true);
    s = random(145,275);
    [s,s]

    Can you tell me exactly how I should be incorporating your added line? This is what I just tried, hoping that it would set the random range between 1 – 30:

    frame = Math.round(time/thisComp.frameDuration);
    seed = Math.floor(frame/30);
    seedRandom(seed,true);
    f = Math.floor(random(0,timeToFrames(thisComp.duration)));
    framesToTime(f)
    s = random(145,275);
    [s,s]

  • Dan Ebberts

    August 24, 2016 at 4:53 pm

    Something like this maybe:


    minFrames = 1;
    maxFrames = 30;
    minScale = 145;
    maxScale = 275;

    f = timeToFrames (inPoint);
    fCur = timeToFrames(time);
    n = 0;

    while (f <= fCur){
    n++;
    seedRandom(n, true);
    durFrames = Math.floor(random(minFrames,maxFrames));
    f += durFrames;
    }
    seedRandom(n,true);
    s = random(minScale,maxScale);
    [s,s]

    Dan

  • Chris Cameron

    August 26, 2016 at 2:15 am

    Thanks so much Dan! That worked beautifully.

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