Advertisement
Guest User

Untitled

a guest
Jan 23rd, 2018
79
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
  1.         function getRandomArbitrary(min, max) {
  2.             return Math.random() * (max - min) + min;
  3.         }
  4.         function getRandomInt(min, max) {
  5.             return Math.floor(Math.random() * (max - min + 1)) + min;
  6.         }
  7.  
  8.         var a = true;
  9.         if (a) {
  10.             for (var i = 0; i < 10; i++) {
  11.                 $('body').append(`
  12.                     <div
  13.                     class="fake_div"
  14.                     style="
  15.                        filter: blur(5px);
  16.                        pointer-events: none;
  17.                        opacity: 0.01;
  18.                        border: 1px solid white;
  19.                        transition: all .3s;
  20.                        position: fixed;
  21.                        left: 0;
  22.                        top: 0;
  23.                        width: 0px;
  24.                        height: 0px;
  25.                        border-radius: 20px;
  26.                    "></div>`);
  27.             }
  28.             $(window).on('scroll', function(e) {
  29.                 $('.fake_div').each(function(index, el) {
  30.                     $(el)
  31.                         .css('border-bottom-width', getRandomInt(15, 20))
  32.                         .css('box-shadow', `1px ${getRandomInt(1, 10)}px 10px`)
  33.                         .css('transform', `
  34.                             translate3d(${getRandomArbitrary(0, 10)}px, ${getRandomArbitrary(0, 10)}px, ${getRandomArbitrary(0, 10)}px)
  35.                             rotate3d(0, 1, 0, ${getRandomArbitrary(0, 45)}deg)
  36.                             scale3d(0.5, 0.5, 0.5)
  37.                         `);
  38.                 });
  39.             });
  40.         }
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement