# Creative Communities of the World Forums

The peer to peer support community for media production professionals.

Forums Adobe After Effects Expressions random duration of a holdTime

• # random duration of a holdTime

2 Members · 5 Posts
• ### Robert Paynter

January 24, 2020 at 3:39 pm

I’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 pm

Varying 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 pm

Perfecto Dan. What would we do without you ?

• ### Robert Paynter

January 24, 2020 at 9:15 pm

This always starts at 0
What if I wanted to start the count on a bigger number?

• ### Robert Paynter

January 24, 2020 at 9:21 pm

nevermind figured it out

easeTime = .2;
minHoldTime = .01;
maxHoldTime = .5;

seg = 0;
segStart = inPoint;
curT = inPoint;
while (curT &lt;= 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"))

Viewing 1 - 5 of 5 posts