Skip to content

Instantly share code, notes, and snippets.

@xirclebox
Created September 25, 2013 09:15
Show Gist options
  • Select an option

  • Save xirclebox/6697068 to your computer and use it in GitHub Desktop.

Select an option

Save xirclebox/6697068 to your computer and use it in GitHub Desktop.
A Pen by Homer Gaines.
<div id="box">&nbsp;</div>
(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();
});
})();
#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