ADOBE AFTER EFFECTS: Forum Expressions Tutorials Creative Cloud

Random Seed with varying "Hold Time"

COW Forums : Adobe After Effects Expressions

<< PREVIOUS   •   FAQ   •   VIEW ALL   •   PRINT   •   NEXT >>
Vladislav Macíček
Random Seed with varying "Hold Time"
on Mar 22, 2018 at 6:35:53 pm

Hey guys, could somebody help me with this?

Basically, I have these inputs:

maxHoldTime = 1.0 [sec];
randomness = 0.5 [0 - 1.0];

minHoldTime = (1 - randomness)*maxHoldTime;

and I need to change a Random Seed value every 'minHoldTime' to 'maxHoldTime' seconds.
Ideally in increments of 1 so the pattern doesn't repeat. Any ideas?

I would be grateful for anything, so thanks in advance,
Vladislav


Return to posts index

Dan Ebberts
Re: Random Seed with varying "Hold Time"
on Mar 22, 2018 at 7:21:21 pm

Play around with this and see if it helps:


maxHoldTime = 1;
minHoldTime = .5;
seedRandom(index,true);
totalTime = 0;
while(totalTime <= time){
holdTime = random(minHoldTime,maxHoldTime);
totalTime += holdTime;
}
holdTime



Dan



Return to posts index

Vladislav Macíček
Re: Random Seed with varying "Hold Time"
on Mar 22, 2018 at 7:56:57 pm

I'm not sure, I tried adding this:

seed = Math.floor(time/holdTime);
seedRandom(seed, true)

but I'm probably doing something wrong...


Return to posts index


Dan Ebberts
Re: Random Seed with varying "Hold Time"
on Mar 22, 2018 at 7:59:07 pm

Depending on what you're planning on doing next, you could just change the last line of my expression to:

seedRandom(holdTime,true);


Dan



Return to posts index

Vladislav Macíček
Re: Random Seed with varying "Hold Time"
on Mar 22, 2018 at 8:10:18 pm

I've got some effect with Random Seed and I want the seed to increment by 1 in the random holdTime intervals. I've got no idea how to do that. Also sorry for my English, it's not my mother tongue.


Return to posts index

Dan Ebberts
Re: Random Seed with varying "Hold Time"
on Mar 22, 2018 at 8:41:07 pm

Try it this way then:


maxHoldTime = 1;
minHoldTime = .5;
seedRandom(index,true);
totalTime = 0;
seed = 1;
while(totalTime <= time){
holdTime = random(minHoldTime,maxHoldTime);
totalTime += holdTime;
seed++;
}
seed;



Dan



Return to posts index


Vladislav Macíček
Re: Random Seed with varying "Hold Time"
on Mar 22, 2018 at 8:50:11 pm

Brilliant, it works exactly how I imagined. You're just awesome!

Thanks,
Vladislav


Return to posts index

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