Thursday, March 21, 2019

HTML

<div class="base">
  <div class="pink"></div>
  <div class="salmon"></div>
  <div class="blue"></div>
  <div class="bluesky"></div>
</div>

CSS

body {
  background-color: #eee7df;
}
body .base {
  width: 100%;
  height: 100vh;
  margin: 0 auto;
  position: relative;
  display: flex;
  align-items: center;
  justify-content: center;
}
body .base .bluesky,
body .base .blue,
body .base .salmon,
body .base .pink {
  border-radius: 4px;
  position: absolute;
  -webkit-animation: ruota 3s ease-in-out infinite alternate;
  animation: ruota 3s ease-in-out infinite alternate;
}
body .base .bluesky {
  width: 35vw;
  height: 35vw;
  z-index: 4;
  border: 2vw solid #7e549f;
}
body .base .blue {
  width: 25vw;
  height: 25vw;
  z-index: 5;
  border: 2vw solid #c1549c;
}
body .base .salmon {
  width: 15vw;
  height: 15vw;
  z-index: 6;
  border: 2vw solid #fb836f;
}
body .base .pink {
  width: 5vw;
  height: 5vw;
  z-index: 7;
  border: 2vw solid #ffcb3e;
}

@keyframes ruota {
  0%,100% {
    transform: rotate3d(1, 1, 1, 0deg);
  }
  50% {
    transform: rotate3d(1, 1, 1, 360deg);
  }
}
@-webkit-keyframes ruota {
  0%,100% {
    -webkit-transform: rotate3d(1, 1, 1, 0deg);
  }
  50% {
    -webkit-transform: rotate3d(1, 1, 1, 360deg);
  }
}
.base div:nth-child(0) {
  animation-delay: 0s;
}

.base div:nth-child(1) {
  animation-delay: 0.15s;
}

.base div:nth-child(2) {
  animation-delay: 0.3s;
}

.base div:nth-child(3) {
  animation-delay: 0.45s;
}

.base div:nth-child(4) {
  animation-delay: 0.6s;
}


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>

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;
}


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'
);

Tuesday, March 19, 2019

HTML


<body>
    <a class="btn">
        <span>
            <span>
                <span>Hover Me</span>
            </span>
        </span>
    </a>
</body>



CSS

body{
margin: 0;
padding: 0;
display: flex;
align-items: center;
justify-content: center;
height: 100vh;
width: 100%;
font-family: sans-serif;
background-color: #f5f5f5;
}

.btn{
font-size: 30px;
text-decoration: none;
position: relative;
padding: 8px 15px;
color: #252525
}

.btn:before, .btn:after{
content: '';
position: absolute;
top: 0;
left: 0;
height: 100%;
width: 100%;
border: 2px solid #252525;
transition: 0.3s ease-in;
}

.btn:hover:before, .btn:hover:after{
transition: 0.3s ease-out;

}

.btn:hover:before{
transform: translate3d(-3px, 3px, 0);
}

.btn:hover:after{
transform: translate3d(3px, -3px, 0);
}


Friday, October 5, 2018

HTML


<body>

<a href="#" class="btn">Hover Me</a>


</body>



CSS

body{
margin: 0;
padding: 0;
display: flex;
align-items: center;
justify-content: center;
height: 100vh;
width: 100%;
font-family: sans-serif;
background-color: #f5f5f5;
}

.btn{
font-size: 30px;
text-decoration: none;
position: relative;
padding: 8px 15px;
color: #252525
}

.btn:before, .btn:after{
content: '';
position: absolute;
top: 0;
left: 0;
height: 100%;
width: 100%;
border: 2px solid #252525;
transition: 0.3s ease-in;
}

.btn:hover:before, .btn:hover:after{
transition: 0.3s ease-out;

}

.btn:hover:before{
transform: translate3d(-3px, 3px, 0);
}

.btn:hover:after{
transform: translate3d(3px, -3px, 0);
}




Sunday, September 16, 2018

HTML


<body>
    
    <div class="code_master">
        <span></span>
        <span></span>
        <span></span>
        <span></span>
        <span></span>
        <span></span>
        <span></span>
        <span></span>
        <span></span>
        <span></span>
    </div>
    
</body>
</html>



CSS

body{
    margin: 0;
    padding: 0;
    height: 100vh;
    display: flex;
    align-items: center;
    justify-content: center;
}
.code_master{
    position: relative;
    width: 600px;
    height: 600px;
    display: flex;
    align-items: center;
    justify-content: center;
}
.code_master span{
    position: absolute;
    animation: animate 10s linear infinite;
}
.code_master span:nth-child(1){
    animation-delay: 0s;
}
.code_master span:nth-child(2){
    animation-delay: 1s;
}
.code_master span:nth-child(3){
    animation-delay: 2s;
}
.code_master span:nth-child(4){
    animation-delay: 3s;
}
.code_master span:nth-child(5){
    animation-delay: 4s;
}
.code_master span:nth-child(6){
    animation-delay: 5s;
}
.code_master span:nth-child(7){
    animation-delay: 6s;
}
.code_master span:nth-child(8){
    animation-delay: 7s;
}
.code_master span:nth-child(9){
    animation-delay: 8s;
}
.code_master span:nth-child(10){
    animation-delay: 9s;
}
@keyframes animate{
    0%{
        width: 0;
        height: 0;
        opacity: 1;
        box-shadow: inset 0 0 20px rgba(0,0,0,.5);
    }
    100%{
        width: 100%;
        height: 100%;
        opacity: 0;
        box-shadow: inset 0 0 50px rgba(0,0,0,1);
    }
}