A Pen by Homer Gaines on CodePen.
Created
September 25, 2013 09:15
-
-
Save xirclebox/6697068 to your computer and use it in GitHub Desktop.
A Pen by Homer Gaines.
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| <div id="box"> </div> |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| (function makeDiv(){ | |
| var blurry = 'blur('+ Math.random() * (80 - 60) + 'px)'.toString(); | |
| var opacity = (Math.random() * (.9 - .2) + .2); | |
| var dotSize = (Math.random() * (250 - 20) + 20).toFixed(); | |
| var when = Math.random() * (Math.round(700 - 300)); | |
| var fadeTime = Math.random() * (Math.round(1000 - 100)); | |
| $newdiv = $('<div/>').css({ | |
| 'width':dotSize+'px', | |
| 'height':dotSize+'px', | |
| 'background-color': '#ffffff', | |
| '-webkit-filter': blurry, | |
| 'opacity': opacity, | |
| }); | |
| var newx = (Math.random() * ($('#box').width() - dotSize)); | |
| var newy = (Math.random() * ($('#box').height() - dotSize)); | |
| $newdiv.css({ | |
| 'position':'absolute', | |
| 'left':newx+'px', | |
| 'top':newy+'px', | |
| 'display':'none', | |
| 'border-radius': '100%', | |
| }).appendTo( '#box' ).fadeIn(700).delay(when).fadeOut(fadeTime, function(){ | |
| makeDiv(); | |
| $(this).remove(); | |
| }); | |
| })(); | |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| #box{ | |
| background-color:#eab600; | |
| width:100%; | |
| height:580px; | |
| margin:0px auto; | |
| } |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment