Forums › Adobe After Effects Expressions › Changing random time
-
Changing random time
-
Scott McGee
January 13, 2023 at 11:34 amPossibly no solution, but i’m going to chuck it out there.
I want to randomly scale my text, but I don’t want it to just be every 1 second, 2 seconds etc. The below works fine if I want it to change every second.
seed = Math.floor(time/1);
seedRandom(seed,true);
s = random(100,150);
[s,s]Is there a way to randomly change this bit?
seed = Math.floor(time/random).
So that when it’s reach 1 lets say, it changes to 0.5, then when it reaches 0.5 it changes to 0.75 (these numbers would be random between set integers obviously)
-
Scott McGee
January 13, 2023 at 11:43 amUnless there’s a tidier way, I think I found something that I’ve altered that appears to work.
minDur = .5;
maxDur = 1;
t = tPrev = inPoint;
seedRandom(index,true);
while (t <= time){
tPrev = t;
t += random(minDur,maxDur);
}
s = random(100,300);
[s,s]
-
Dan Ebberts
January 13, 2023 at 3:04 pmThat’s pretty much how I’d do it unless you want to ramp from one value to the next, in which case I’d do something like this:
minVal = 100;
maxVal = 300;
minDur = .5;
maxDur = 1;
tEase = .1;
t = tPrev = inPoint;
seedRandom(index,true);
while (t <= time){
tPrev = t;
t += random(minDur,maxDur);
}
seedRandom(tPrev,true);
s1 = random(minVal,maxVal);
seedRandom(t,true);
s2 = random(minVal,maxVal);
s = ease(time,tPrev,tPrev+tEase,s1,s2);
[s,s]
Log in to reply.