Random Lines


This expression will move a vertical bar back and forth across the screen randomly.

Create a thin, rectangular solid.

Apply the following expression to the position property:


tMin = .5; //minimum segment duration 
tMax = 2;  //maximum segment duration

end = 0; 
j = 0; 
while (time >= end){ 
  j++; 
  seedRandom(j,true); 
  start = end; 
  end += random(tMin,tMax); 
} 
endVal = random(thisComp.width); 
seedRandom(j - 1,true); 
x = random(); //this is a throw-away value 
startVal = random()*this_comp.width;
x = ease(time,start,end,startVal,endVal);
[x,value[1]]

tMin and tMax are the minimum and maximum time it takes for the line to make one movement. Adjust them to suit your needs.

Duplicate the solid a bunch of times to generate a lot of motion.