ADOBE AFTER EFFECTS: Forum Expressions Tutorials Creative Cloud

# Linear play hold play

FAQ   •   VIEW ALL
 Linear play hold play on Jan 26, 2017 at 6:56:31 pm

Hi forum,

I have a linear on Rotation using linear(time,inPoint,10,0,360);
How can i add hold for few frames (eg 3 frames) at random time (in duration inpoint to 10) and resume play and again..?

I have been searching but no luck
Any help.
Thanks

 Re: Linear play hold playon Jan 26, 2017 at 7:30:34 pm

Something like this might work:

``` hDur = 3; // hold frames; h = framesToTime(hDur); seedRandom(index,true); hStart = random(inPoint,10-h); if (time < hStart) linear(time,inPoint,10,0,360) else if (time < hStart+h) linear(hStart,inPoint,10,0,360) else linear(time-h,inPoint,10,0,360) ```

Dan

 Re: Linear play hold playon Jan 27, 2017 at 6:45:23 am

Thank you for your response Dan,
it work only one pause, but how to pause multiple time like play, stop, resume play, stop again.

Thanks

 Re: Linear play hold playon Jan 28, 2017 at 7:25:21 am

i found this similar from your previous reply in case random pulsing, can it applied to this case?

Ilya

```minHold = 24; // min hold frames maxHold = 40; // max hold frames fade = 12; // fade frames seedRandom(index,true); t = t0 = 0; hold1 = minHold; f = fade*thisComp.frameDuration; while (t &lt;= time){ hold1 = Math.round(random(minHold,maxHold))*thisComp.frameDuration; hold2 = Math.round(random(minHold,maxHold))*thisComp.frameDuration; t0 = t; t += f*2 + hold1 + hold2; } t1 = t0 + f; t2 = t1 + hold1; t3 = t2 + f; if (time &lt; t1) linear(time,t0,t1,0,100) else if (time &lt; t2) 100 else if (time &lt; t3) linear(time,t2,t3,100,0) else 0;```

 Re: Linear play hold playon Feb 20, 2017 at 7:54:04 pmLast Edited By Sergej Mag on Feb 21, 2017 at 9:49:53 am

I had a similar situation. I had to repeat the movement and the occasional long pauses. Maybe my expression is useful to you.
and see more random rotation with accumulating loop
Sorry for my English!

```segMin = 2.5; //minimum segment duration sec segMax = 5; //maximum segment duration sec runDur = 1.5; // run duration oldPos = 2380; // x position start newPos = -500; // x position end yPos = 0; // y position end = 0; j = 0; while ( time >= end){ j += 1; seedRandom(j,true); start = end; end += random(segMin,segMax); } if (time > end - runDur) { seedRandom(j,true); y = random(0,1080); linear(time,end-runDur,end,[oldPos,y],[newPos,y]) }else{ seedRandom(j,true); y = random(0,1080); [newPos, yPos+y] } ================================== // random rotation with accumulating loop j = 0; //initialize loop counter accum = 0; //initialize random accumulator seedRandom(index,true) while (j < time){ accum += random(10); j += thisComp.frameDuration; } rotation + accum```