SHARE
TWEET

Untitled

a guest Aug 13th, 2017 55 Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
  1. // globals are bad
  2. var someGlobalStop = false;
  3.  
  4. function createAnimateFunction(randMax, moveMin, duration) {
  5.   var __animate = function (){
  6.         var rnd = Math.ceil(Math.random() * randMax) + moveMin,
  7.           rnd2 = Math.ceil(Math.random() * randMax) + moveMin,
  8.           props = {
  9.           marginBottom: rnd,
  10.           marginTop: rnd,
  11.           marginLeft:rnd2,
  12.           marginRight: rnd2
  13.         };
  14.                 if(! someGlobalStop)  {
  15.             $(this).animate(props, duration, __animate);
  16.                 }
  17.     };
  18.    
  19.     return __animate;
  20. }
  21.  
  22. function animatesmall(){
  23.   $('ul.work li.small').each(createAnimateFunction(30, 10, 900));
  24. }
  25. function animatemedium(){
  26.     $('ul.work li.medium').each(createAnimateFunction(50, 20, 1900));
  27. }
  28. function animatelarge(){
  29.     $('ul.work li.large').each(createAnimateFunction(50, 30, 2300));
  30. }
RAW Paste Data
Top