HTML
<div class="img-container">
<h2>Welcome!</h2>
<h3>Insert Subtitle here</h3>
</div>
<div class="preloader">
<div class="circle circle1"></div>
<div class="circle circle2"></div>
<div class="circle circle3"></div>
</div>
<h2>Welcome!</h2>
<h3>Insert Subtitle here</h3>
</div>
<div class="preloader">
<div class="circle circle1"></div>
<div class="circle circle2"></div>
<div class="circle circle3"></div>
</div>
CSS
body {
padding: 0;
margin: 0;
background-color: #3e3c41;
font-family: 'Montserrat', sans-serif;
}
body,
html {
width: 100%;
height: 100%;
}
.img-container {
background-position: top center;
background-size: cover;
width: 100%;
height: 100%;
z-index: 5;
position: absolute;
}
.img-container h2,
.img-container h3 {
color: #fff;
text-align: center;
position: relative;
text-shadow: 0 4px 4px rgba(0, 0, 0, 0.4);
}
h2 {
font-size: 70px;
margin-bottom: 0;
}
h3 {
font-size: 40px;
margin-bottom: 0;
}
.preloader {
width: 100%;
height: 100%;
background-color: #3e3c41;
z-index: 10;
position: absolute;
}
.circle {
border-radius: 190px;
box-shadow: 0 4px 8px rgba(0, 0, 0, 0.4);
position: absolute;
top: 50%;
left: 50%;
opacity: 0;
}
.circle1 {
background-color: #7752d5;
width: 240px;
height: 240px;
margin-top: -120px;
margin-left: -120px;
}
.circle2 {
background-color: #8362d9;
width: 170px;
height: 170px;
margin-top: -85px;
margin-left: -85px;
}
.circle3 {
background-color: #9f88d6;
width: 100px;
height: 100px;
margin-top: -50px;
margin-left: -50px;
}
padding: 0;
margin: 0;
background-color: #3e3c41;
font-family: 'Montserrat', sans-serif;
}
body,
html {
width: 100%;
height: 100%;
}
.img-container {
background-position: top center;
background-size: cover;
width: 100%;
height: 100%;
z-index: 5;
position: absolute;
}
.img-container h2,
.img-container h3 {
color: #fff;
text-align: center;
position: relative;
text-shadow: 0 4px 4px rgba(0, 0, 0, 0.4);
}
h2 {
font-size: 70px;
margin-bottom: 0;
}
h3 {
font-size: 40px;
margin-bottom: 0;
}
.preloader {
width: 100%;
height: 100%;
background-color: #3e3c41;
z-index: 10;
position: absolute;
}
.circle {
border-radius: 190px;
box-shadow: 0 4px 8px rgba(0, 0, 0, 0.4);
position: absolute;
top: 50%;
left: 50%;
opacity: 0;
}
.circle1 {
background-color: #7752d5;
width: 240px;
height: 240px;
margin-top: -120px;
margin-left: -120px;
}
.circle2 {
background-color: #8362d9;
width: 170px;
height: 170px;
margin-top: -85px;
margin-left: -85px;
}
.circle3 {
background-color: #9f88d6;
width: 100px;
height: 100px;
margin-top: -50px;
margin-left: -50px;
}
JS
var $circles = $('.circle'),
tl = new TimelineMax(),
random1 = getRandomNumber(),
imgUrl1 = 'https://s3-us-west-2.amazonaws.com/s.cdpn.io/409269/valley.jpg?' + random1,
image1 = $('<img>');
function loaderOut() {
console.log('Image is done loading.');
}
function getRandomNumber() {
return Math.floor(Math.random() * 10000);
}
image1.on('load', loaderOut);
image1.attr('src', imgUrl1);
TweenMax.set($circles, {scale: 0});
tl.insert(
TweenMax.staggerTo($circles.toArray(), 1, {
opacity: 1,
scale: 1,
ease: Power1.easeIn
}, 0.2)
);
tl.insert(
TweenMax.staggerTo($circles.toArray(), 0.5, {
scale: 1.2,
boxShadow: '0 25px 25px rgba(0, 0, 0, 0.4)',
repeat: -1,
yoyo: true,
ease: Power1.easeOut
}, 0.2), '-=0.4'
);
0 comments:
Post a Comment