Creative Communities of the World Forums

The peer to peer support community for media production professionals.

Activity Forums Adobe After Effects Expressions Linear play hold play

  • Linear play hold play

    Posted by Ilya Sire on January 26, 2017 at 6:56 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

    Sergej Mag replied 9 years, 2 months ago 3 Members · 4 Replies
  • 4 Replies
  • Dan Ebberts

    January 26, 2017 at 7:30 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

  • Ilya Sire

    January 27, 2017 at 6:45 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

  • Ilya Sire

    January 28, 2017 at 7:25 am

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

    Please help. ☺
    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;

  • Sergej Mag

    February 20, 2017 at 7:54 pm

    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

We use anonymous cookies to give you the best experience we can.
Our Privacy policy | GDPR Policy