Creative Communities of the World Forums

The peer to peer support community for media production professionals.

Activity Forums Adobe After Effects Expressions Random intervals between LoopOut (‘pingpong’)

  • Random intervals between LoopOut (‘pingpong’)

    Posted by Saulo Dal pozzo on January 31, 2023 at 5:57 pm

    Hey! Thanks for your time.

    So I have a shape layer with 2 keyframes in its scale from 0 to 100 with a specific easing. I wanted to use the LoopOut PingPong expression in such a manner that the animation randomly holds, for a random duration, at both 0 and 100 before continuing with the loop.

    It would look like this: the shape goes from 0 to 100 scale, stays at 100 for a random amount of time, then goes back to 0 and stays at 0 for a random amount of time.

    Is it possible?

    Saulo Dal pozzo replied 3 years, 6 months ago 2 Members · 2 Replies
  • 2 Replies
  • Dan Ebberts

    January 31, 2023 at 6:38 pm

    I think it will look something like this:

    minHold = .1;
    maxHold = .75;
    t1 = key(1).time;
    t2 = key(2).time;
    d = t2 - t1;
    if (time >= t1){
    t = tPrev = t1;
    while (t <= time){
    tPrev = t;
    seedRandom(tPrev,true);
    h1 = random(minHold,maxHold);
    h2 = random(minHold,maxHold);
    t += d*2 + h1 + h2;
    }
    tDiff = time - tPrev;
    if (tDiff < d)
    valueAtTime (t1 + tDiff)
    else if (tDiff < d + h1)
    key(2).value
    else if (tDiff < 2*d + h1)
    valueAtTime(t2 - (tDiff - (d + h1)))
    else
    key(1).value;
    }else
    value
  • Saulo Dal pozzo

    January 31, 2023 at 6:45 pm

    Worked like a charm! Thanks a lot

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