Forums › Adobe After Effects Expressions › random duration of a holdTime
random duration of a holdTime
Robert Paynter
January 24, 2020 at 3:39 pmI’m using an number odometer built . The count of this odometer is driven by a angle controller using with the expression below. I want the numbers to tick up more naturally. I’m using the expression below. I’d like to have a hold time duration be more random between .1 and .5. Any help would be much appreciated.
easeTime = .2;
holdTime =.5;
amt = 36;
period = easeTime+holdTime;
t = time - inPoint;
seg = Math.floor(t/period);
p = t%period;
seg*amt + ease(p,0,easeTime,0,amt)Dan Ebberts
January 24, 2020 at 8:20 pmVarying the hold time will mess up the entire expression, so you would need to go to a more cumbersome model, like this:
easeTime = .2;
minHoldTime = .1;
maxHoldTime = .5;seg = 0;
segStart = inPoint;
curT = inPoint;
while (curT <= time){
seedRandom(seg,true);
holdTime = random(minHoldTime,maxHoldTime);
period = easeTime+holdTime;
segStart = curT;
seg++
curT += period;
}
t = time - segStart
amt = 36;
(seg-1)*amt + ease(t,0,easeTime,0,amt)
Dan
Robert Paynter
January 24, 2020 at 8:48 pmPerfecto Dan. What would we do without you ?
Robert Paynter
January 24, 2020 at 9:15 pmThis always starts at 0
What if I wanted to start the count on a bigger number?Robert Paynter
January 24, 2020 at 9:21 pmnevermind figured it out
easeTime = .2;
minHoldTime = .01;
maxHoldTime = .5;seg = 0;
segStart = inPoint;
curT = inPoint;
while (curT <= time){
seedRandom(seg,true);
holdTime = random(minHoldTime,maxHoldTime);
period = easeTime+holdTime;
segStart = curT;
seg++
curT += period;
}
t = time - segStart
amt = 36;
(seg-1)*amt + ease(t,0,easeTime,0,amt)+(36*effect("Slider Control 2")("Slider"))
Log in to reply.