ADOBE AFTER EFFECTS: Forum Expressions Tutorials Creative Cloud

Random Hold Times between Each Loop

COW Forums : Adobe After Effects Expressions

<< PREVIOUS   •   FAQ   •   VIEW ALL   •   PRINT   •   NEXT >>
Jim Huffaker
Random Hold Times between Each Loop
on Feb 16, 2015 at 10:26:28 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


Return to posts index

Dan Ebberts
Re: Random Hold Times between Each Loop
on Feb 18, 2015 at 5:31:41 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



Return to posts index

Jim Huffaker
Re: Random Hold Times between Each Loop
on Feb 18, 2015 at 4:40:35 pm

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


Return to posts index


Benoit Kergosien
Re: Random Hold Times between Each Loop
on Jun 22, 2017 at 1:43:10 pm

Hi,

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

Thanks,

BenoƮt.


Return to posts index

<< PREVIOUS   •   VIEW ALL   •   PRINT   •   NEXT >>
© 2017 CreativeCOW.net All Rights Reserved
[TOP]