$(window).on('resize', function(){
$('body').css({width:$(window).width(),height:$(window).height()});
}).trigger('resize');
function FlyCard(){
this.wrap = $('
');
this.card = this.wrap.find('.card');
var me = this;
var addRound = 1;
var minRound = 1;
var rz = Math.random()*360*addRound+360*minRound;
var rx = Math.random()*360*addRound+360*minRound;
var ry = Math.random()*360*addRound+360*minRound
rz = rz /2 - rz;
rx = rx /2 - rx;
ry = ry /2 - ry;
var offsetLeft = Math.random() * 120 - 60 + 50;
var offsetTop = Math.random() * 120 - 60 + 50;
TweenLite.set(this.wrap,{left:'50%',top:'50%',display:'block'});
TweenLite.to(this.wrap,2,{left:offsetLeft+'%'});
TweenLite.to(this.wrap,2,{top:offsetTop+'%'});
TweenLite.fromTo(this.wrap,1,{css:{transform:'translateZ(-2400px)'}},{css:{transform:'translateZ(0px)'}});
TweenLite.to(this.wrap,1,{opacity:0,delay:1});
TweenLite.to(this.wrap,2,{rotationZ:rz,rotationX:rx,rotationY:ry,onComplete:function(){
me.wrap.remove();
}});
$('body').append(this.wrap);
}
(function loop(){
new FlyCard();
requestAnimationFrame(loop);
})();