Advertisement
Katsiree

bonut

May 2nd, 2019
129
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
  1. <script>
  2.         $(document).ready(function () {
  3.  
  4.             var grad = $('.p_border_r').css('background');
  5.             var deg = 45;
  6.             var lastms = 0;
  7.             var animate = true;
  8.  
  9.             var callback = function (time) {
  10.                 if (lastms == 0) {
  11.                     lastms = time;
  12.                 }
  13.                 deg = (deg + (time - lastms) * 0.3);
  14.                 lastms = time;
  15.                 while (deg > 360) {
  16.                     deg -= 360;
  17.                 }
  18.                 var newCss = grad.replace('45deg', deg + 'deg');
  19.  
  20.                 $('.p_border_r').css('background', newCss);
  21.                 if (animate) {
  22.                     window.requestAnimationFrame(callback);
  23.                 } else {
  24.                     lastms = 0;
  25.                 }
  26.             };
  27.  
  28.             window.requestAnimationFrame(callback);
  29.  
  30.         })
  31.     </script>
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement