FORUMS: list search recent posts

Play comp from random point for 3 seconds, repeat

COW Forums : Adobe After Effects Expressions

<< PREVIOUS   •   FAQ   •   VIEW ALL   •   PRINT   •   NEXT >>
Trevor Brennan
Play comp from random point for 3 seconds, repeat
on Jun 15, 2017 at 11:01:54 am

Hi friends, I've been trawling through the forums all night to work this out and simply can't, so it's time to reach out.

As the title hints; I have a comp in my comp, which i want to play a random part of every 3 seconds. I've been putting my expressions on the the timeRemap, and can move it to a random frame, but the expression is called every frame of time, so it doesn't play, it just bounces around as the script gets executed... I'm thinking i need a loop or wait/delay for X seconds but can't find a way to get and set a global variable to do that the way I would in other languages.

Any help would be super appreciated.

// close'ish
// Jumps to random frame, but i need it to wait for 75 frames now before doing it again?

x = timeToFrames(thisComp.duration);
i = random(0,x);
framesToTime(i);


// found this on the forums for fading out opacity
// thought i might work on a slider hooked up to timeremap with maxVal/minVal as startframe/endframe
// but that just does crazy stuff

period = framesToTime(20);
t = (time-inPoint)%period;
minVal = 0;
maxVal = 100;
linear(t,0,period,maxVal,minVal)


Return to posts index

Dan Ebberts
Re: Play comp from random point for 3 seconds, repeat
on Jun 15, 2017 at 12:53:32 pm

Try this:

dur = 3;
seed = Math.floor(time/dur);
t = time%dur;
seedRandom(seed,true);
tStart = random(outPoint-dur);
tStart + t;


Dan



Return to posts index

Trevor Brennan
Re: Play comp from random point for 3 seconds, repeat
on Jun 17, 2017 at 10:02:58 am

Works flawlessly Dan! Thank you.

If it wouldn't be too much trouble would you mind explaining how it works so i can learn? I simply can't understand the what it's doing.


Return to posts index

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