Advertisement
Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- function getRandomArbitrary(min, max) {
- return Math.random() * (max - min) + min;
- }
- function getRandomInt(min, max) {
- return Math.floor(Math.random() * (max - min + 1)) + min;
- }
- for (var i = 0; i < 10; i++) {
- $('body').append(`
- <div
- class="fake_div"
- style="
- filter: blur(5px);
- pointer-events: none;
- opacity: 0.01;
- border: 1px solid white;
- transition: all .3s;
- position: fixed;
- left: 0;
- top: 0;
- width: 0px;
- height: 0px;
- border-radius: 20px;
- "></div>`);
- }
- $(window).on('scroll', function(e) {
- $('.fake_div').each(function(index, el) {
- $(el)
- .css('border-bottom-width', getRandomInt(15, 20))
- .css('box-shadow', `1px ${getRandomInt(1, 10)}px 10px`)
- .css('transform', `
- translate3d(${getRandomArbitrary(0, 10)}px, ${getRandomArbitrary(0, 10)}px, ${getRandomArbitrary(0, 10)}px)
- rotate3d(0, 1, 0, ${getRandomArbitrary(0, 45)}deg)
- scale3d(0.5, 0.5, 0.5)
- `);
- });
- });
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement