Skip to content

Commit

Permalink
Let it rain
Browse files Browse the repository at this point in the history
  • Loading branch information
drewwells committed Feb 13, 2012
1 parent 04068d9 commit c09c38a
Showing 1 changed file with 37 additions and 0 deletions.
37 changes: 37 additions & 0 deletions main.js
Expand Up @@ -180,3 +180,40 @@ graph.done(function(){
return post;
};*/


/* Snow machine */
(function( $ ){

window.requestAnimFrame = (function(){
return window.requestAnimationFrame ||
window.webkitRequestAnimationFrame ||
window.mozRequestAnimationFrame ||
window.oRequestAnimationFrame ||
window.msRequestAnimationFrame ||
function( callback ){
window.setTimeout(callback, 1000 / 60);
};
})();

var heart = $( ".heart" ),
$body = $( 'body' ),
width = $body.width(),
count = 0;;

(function rain(){

heart.clone().css({
'margin-left': Math.random() * width,
'font-size': Math.random() * 3 + 'em'
}).appendTo( 'body' );

if( count++ < 20 ){

window.requestAnimFrame(function(){

window.setTimeout( rain, 500 );
});
}
})();

})( window.jQuery );

0 comments on commit c09c38a

Please sign in to comment.