Creative Communities of the World Forums

The peer to peer support community for media production professionals.

Activity Forums Adobe After Effects Expressions Display random frames without consecutive repetitions?

  • Dan Ebberts

    November 21, 2007 at 9:18 pm

    The basic idea would be something like this:

    numFrames = 6;

    seedRandom(index,true);
    f = Math.floor(random(numFrames));
    for (i = 0; i

  • Danny Parsons

    November 22, 2007 at 12:38 pm

    Thanks, Dan, for your swift response. I

  • Dan Ebberts

    November 22, 2007 at 4:54 pm

    Sorry, the expression got trashed on it’s way to the page. Let me try it again. And yes, it’s for time remapping.

    numFrames = 6;

    seedRandom(index,true);
    f = Math.floor(random(numFrames));
    for (i = 0; i <= timeToFrames(time); i++){ f = (f + Math.floor(random(1,numFrames-1)))%numFrames; } framesToTime(f) Dan

  • Danny Parsons

    November 22, 2007 at 5:41 pm

    Thanks! The repaired expression works a treat.

    Unfortunately, however, a solution to the frame-rate issue still eludes me. Any suggestions?

    Slightly off-subject, but relating to a potential back-up plan if I can

  • Mike Derk

    December 5, 2007 at 8:24 pm

    Wow, I was going to come on and ask just this exact question. And, by the way, I understand nothing in your expressions except the “modular function”.

    So, here is my follow-on question: how would I alter the code if I wanted each individual drawing to play for 2 or 3 frames. For my purposes, playing only 1 frame is a bit fast.

    Thanks,

    Mike

  • Dan Ebberts

    December 5, 2007 at 8:54 pm

    This should do it:

    numFrames = 6;
    holdFrames = 3;

    seedRandom(index,true);
    f = Math.floor(random(numFrames));
    for (i = 0; i <= Math.floor(timeToFrames(time)/holdFrames); i++){ f = (f + Math.floor(random(1,numFrames-1)))%numFrames; } framesToTime(f) Dan

  • Mike Derk

    December 5, 2007 at 9:53 pm

    Thanks!

  • Danny Parsons

    December 7, 2007 at 1:45 am

    And I guess that more or less sorts out my frame-rate problem as well!

    Whilst it would have been nice for any further animation added in the main comp to also be at the low frame-rate, I’m happy to choose this new expression over any of the relatively time-consuming makeshift ‘get-arounds’ I’ve come up with since conquering that initial hurdle (I’ve got a lot of scenes in this same style to get through).

    So any ingenious suggestions that would achieve my ideal are still welcome!

    For the meantime though: Thanks again, Dan, and thanks, Mike, for inadvertently pointing me towards a forehead-slappingly obvious solution!

    Cheers,

    DP

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