Creative Communities of the World Forums

The peer to peer support community for media production professionals.

Activity Forums Adobe After Effects Expressions Random Hold Times between Each Loop

  • Random Hold Times between Each Loop

    Posted by Jim Huffaker on February 16, 2015 at 10:26 pm

    I’ve looked all over for a similar solution, but I’m not sure if I’ve found one.

    Say I have animated a layer’s position with two keyframes. I want the animation to loop endlessly, however, I want the start time of each loop to be randomized. Or, rather, a randomized hold before each next loop. Is there a way to do this?

    Thanks,

    Jim

    Benoit Kergosien replied 8 years, 10 months ago 3 Members · 3 Replies
  • 3 Replies
  • Dan Ebberts

    February 18, 2015 at 5:31 am

    I think this works:


    if (numKeys > 1){
    minDelay = 1;
    maxDelay = 4;
    t1 = key(1).time;
    t2 = key(numKeys).time;
    if (time > t2){
    acc = t2;
    i = 1;
    while (acc <= time){
    seedRandom(i,true);
    delay = random(minDelay,maxDelay);
    prev = acc;
    acc += delay + (t2 - t1);
    i++;
    }
    if (time < prev + delay)
    valueAtTime(t2)
    else
    valueAtTime(t1 + time - (prev + delay));
    }else
    value;
    }else
    value

    Dan

  • Jim Huffaker

    February 18, 2015 at 4:40 pm

    Oh wow. Awesome. I was worried the only solution was the time-based problem kind. Thanks!

  • Benoit Kergosien

    June 22, 2017 at 1:43 pm

    Hi,

    Sorry to dig but would it be possible with a pingpong loop?

    Thanks,

    Benoît.

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