Creative Communities of the World Forums

The peer to peer support community for media production professionals.

Activity Forums Adobe After Effects Expressions Random frame with time controlled

  • Random frame with time controlled

    Posted by Ilya Sire on November 2, 2016 at 11:38 am

    Hi,

    I found this thread https://forums.creativecow.net/thread/227/30852#30862
    An expression to pick randomize frame and it works perfectly, it randomize every frame, but how can i change it to randomize frame every 5 frames?

    Please help
    ilya

    numFrames = 132;
    a = [];
    seedRandom(index,true);
    for (i = 0; i < numFrames; i++)a.push(i);
    for (i = 0; i < numFrames; i++){
    idx = i + Math.floor(random(a.length - i));
    temp = a[i];
    a[i] = a[idx];
    a[idx] = temp;
    }
    idx = timeToFrames(time)%numFrames;
    framesToTime(a[idx])

    Ilya Sire replied 9 years, 6 months ago 2 Members · 2 Replies
  • 2 Replies
  • Dan Ebberts

    November 2, 2016 at 5:14 pm

    Try changing this line:

    idx = timeToFrames(time)%numFrames;

    to this:

    idx = Math.floor(timeToFrames(time)/5)%numFrames;

    Dan

  • Ilya Sire

    November 3, 2016 at 10:48 am

    wow, that simple.
    Thank you so much.

    ilya

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