Advertisement
Tuppu

Untitled

Mar 12th, 2019
133
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
  1. <script>  
  2.     this.state = {
  3.         index: 0,
  4.         right: true,
  5.         prevMouseX: 0,
  6.         now: 0
  7.     }
  8.  
  9.  
  10. function Fancy() {
  11.         setTimeout(function()
  12.         {
  13.             var wave = ['\u4DEB', '\u4DCC', '\u4DC9', '\u4DC8', '\u4DCD',
  14.             '\u4DC8', '\u4DC9', '\u4DCC'];
  15.  
  16.             var hash = '';
  17.             for (var i=0; i < 64; ++i) {
  18.                 hash += wave[(i+state.index) % wave.length];
  19.             }
  20.  
  21.             var currentMouseX = window.mouseX;
  22.             if (currentMouseX > state.prevMouseX) {
  23.                 state.right = true;
  24.             } else if (currentMouseX < state.prevMouseX) {
  25.                 state.right = false;
  26.             } else {
  27.                 state.right = state.right;
  28.             }
  29.             if (state.right) {
  30.                 window.location.replace('#'+hash.split("").reverse().join(""));
  31.                 state.right = true;
  32.             } else {
  33.                 window.location.replace('#'+hash.split("").reverse().join(""));
  34.                 state.right = false;
  35.             }
  36.             state.index = (state.index == wave.length-1) ? 0 : state.index+1;
  37.             state.prevMouseX = currentMouseX;  
  38.  
  39.         }, 50);
  40.       }
  41.  
  42.  
  43.        this.Fancy();
  44. </script>
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement