Expression Library

Random Rotation

Author: Dan Ebberts

Randomly rotates a layer between specified values at random time intervals.

Code Sample

Hover over the code and click the copy button.

				
					tMin = .25; //minimum segment duration
tMax = 1.0; //maximum segment duration
minVal = 0;
maxVal = 720;

end = 0;
j = 0;
while ( time >= end){
  j ++;
  seedRandom(j,true);
  start = end;
  end += random(tMin,tMax);
}
endVal =  random(minVal,maxVal);
seedRandom(j - 1,true);
dummy = random(); //this is a throw-away value
startVal =  random(minVal,maxVal);
ease(time,start,end,startVal,endVal)