Advertisement
Guest User

Untitled

a guest
Jan 23rd, 2018
81
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.         for (var i = 0; i < 10; i++) {
  9.             $('body').append(`
  10.                 <div
  11.                 class="fake_div"
  12.                 style="
  13.                    filter: blur(5px);
  14.                    pointer-events: none;
  15.                    opacity: 0.01;
  16.                    border: 1px solid white;
  17.                    transition: all .3s;
  18.                    position: fixed;
  19.                    left: 0;
  20.                    top: 0;
  21.                    width: 0px;
  22.                    height: 0px;
  23.                    border-radius: 20px;
  24.                "></div>`);
  25.         }
  26.         $(window).on('scroll', function(e) {
  27.             $('.fake_div').each(function(index, el) {
  28.                 $(el)
  29.                     .css('border-bottom-width', getRandomInt(15, 20))
  30.                     .css('box-shadow', `1px ${getRandomInt(1, 10)}px 10px`)
  31.                     .css('transform', `
  32.                         translate3d(${getRandomArbitrary(0, 10)}px, ${getRandomArbitrary(0, 10)}px, ${getRandomArbitrary(0, 10)}px)
  33.                         rotate3d(0, 1, 0, ${getRandomArbitrary(0, 45)}deg)
  34.                         scale3d(0.5, 0.5, 0.5)
  35.                     `);
  36.             });
  37.         });
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement