Advertisement
zebadeee

Random Motion @ Random Time

May 16th, 2024
589
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
  1. moveMin = .3; //minimum move time
  2. moveMax = .7; //maximum move time
  3.  
  4. pauseMin = .1; // minimum pause time
  5. pauseMax = 5.; // maximum pause time
  6.  
  7. minVal = [0.1*thisComp.width, 0.1*thisComp.height];
  8. maxVal = [0.9*thisComp.width, 0.9*thisComp.height];
  9.  
  10. endT = 0;
  11. j = 0;
  12. k = 0;
  13. while ( time >= endT){
  14.   j += 1;
  15.   seedRandom(j,true);
  16.   startT = endT;
  17.   if (j%2){
  18.     endT += random(moveMin,moveMax);
  19.     k++;
  20.   }else{
  21.     endT += random(pauseMin,pauseMax);
  22.   }
  23. }
  24. if (j%2){
  25.   seedRandom(k,true);
  26.   endVal = random(minVal,maxVal);
  27.   seedRandom(k-1,true);
  28.   startVal = random(minVal,maxVal);
  29.   ease(time,startT,endT,startVal,endVal)
  30. }else{
  31.   seedRandom(k,true);
  32.   random(minVal,maxVal)
  33. }
Tags: random
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement