|
var tb = 100 |
|
,cl = ['#000','#111','#222','#333','#444','#555','#666','#777','#888','#999'] |
|
,wi = '100px' |
|
,he = '100px' |
|
,sl = 4 |
|
,fs = 0.3 |
|
,ea = 'ease:Power2.easeOut' |
|
,SH = $(document).height() |
|
,SW = $(document).width() |
|
,SMT = SH / 2 |
|
,SML = SW / 2 |
|
,tl = new TimelineMax() |
|
,$bd = $('body') |
|
,blc = '<div class="block" style="' |
|
+'border:solid 1px '+cl[1]+';' |
|
//+'box-shadow:0 0 4px '+cl[2]+' inset;' |
|
+'width:'+wi+';height:'+he+';' |
|
+'background:'+cl[3]+';' |
|
+'position:absolute;' |
|
+'outline:solid 1px '+cl[3]+';' |
|
+'">' |
|
,shaT= '<div class="shadowT"></div>' |
|
,shaB= '<div class="shadowB"></div>' |
|
; |
|
|
|
function comingFromBehind(){ |
|
|
|
//Reset - Body Design |
|
$bd.css({background: '#222',margin:0,padding:0,border:0,overflow:'hidden'}); |
|
|
|
//DrawShadow - Layer top - Nice Shadow Efect |
|
$bd.append(shaT); |
|
$bd.append(shaB); |
|
|
|
//Design them from the center - Blocks |
|
for(i = 0 ; i < tb ; i++ ){ |
|
$bd.append(blc); |
|
} |
|
|
|
//Center elements |
|
TweenMax.set($bd.find('.block'),{top:-10,left:SML,rotation:0,transformOrigin:"0 0"}); |
|
|
|
//Animation |
|
tl.staggerTo($bd.find('.block'), sl, {top:SH,rotation:360,transformOrigin:"0 0",repeat:-1, yoyo:true}, 0.02); |
|
tl.play(); |
|
|
|
} |
|
|
|
$(window).load(function(){ |
|
comingFromBehind(); |
|
}) |
|
|
|
$(window).resize(function() { |
|
//Clean Body |
|
$bd.html(''); |
|
comingFromBehind(); |
|
}); |
|
|
|
|
|
|
|
|