Creative Communities of the World Forums

The peer to peer support community for media production professionals.

Activity Forums Adobe After Effects adding decay to Dan’s random lines script

  • adding decay to Dan’s random lines script

    Posted by Gary Nicholson on January 11, 2006 at 5:19 am

    Hi Dan

    Is there a way to add decay to your Random Line script.

    Also a big thanks for your support to After Effects scripting.

    Gary

    PS Anyone can jump in if they have a solution thanks.

    Gary Nicholson replied 20 years, 4 months ago 2 Members · 4 Replies
  • 4 Replies
  • Dan Ebberts

    January 11, 2006 at 2:18 pm

    I’m not sure what you mean by decay. Do you want the lines to slow down and stop at random positions, return to their original positions, or something else entirely?

    Dan

  • Gary Nicholson

    January 12, 2006 at 12:43 am

    Hi Dan

    Slowing the lines down to a stop is the effect I’m after.

    Thx

    Gary

  • Dan Ebberts

    January 12, 2006 at 4:01 am

    I was afraid of that. 🙂

    Something like this might work:

    
    
    decayStart = 4;
    decaySpeed = 4;
    segMin = .3; //minimum segment duration
    segMax = .7; //maximum segment duration
    minVal = 0;
    maxVal = thisComp.width;
    
    end = 0;
    j = 0;
    if (time > decayStart){
      delta = time - decayStart;
      factor = 1 + delta*delta*decaySpeed;
    }else{
     factor = 1;
    }
    while ( time >= end){
      j += 1;
      seedRandom(j,true);
      start = end;
      end += random(segMin,segMax)*factor;
    }
    endVal =  random(minVal,maxVal);
    seedRandom(j-1,true);
    dummy=random(); //this is a throw-away value
    startVal =  random(minVal,maxVal);
    y = position[1];
    ease(time,start,end,[startVal,y],[endVal,y])
    
    

    Dan

  • Gary Nicholson

    January 13, 2006 at 12:36 am

    Hi Dan

    Just what I needed, thanks for your help and time.

    Gary

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