Last active
November 2, 2017 14:57
-
-
Save samcyn/5dcbcc8e5c5be9392c2699d080714493 to your computer and use it in GitHub Desktop.
A match box loader. Day2 30 days challenge
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
<!DOCTYPE html> | |
<html lang="en"> | |
<head> | |
<meta charset="UTF-8"> | |
<meta name="viewport" content="width=device-width, initial-scale=1.0"> | |
<meta http-equiv="X-UA-Compatible" content="ie=edge"> | |
<title>Document</title> | |
<style> | |
.stage { | |
position: absolute; | |
top: 50%; | |
left: 50%; | |
width: 500px; | |
height: 500px; | |
margin-top: -250px; | |
margin-left: -250px; | |
border-radius: 2px; | |
box-shadow: 1px 2px 10px 0px rgba(0, 0, 0, 0.1); | |
overflow: hidden; | |
background: #34495e; | |
color: #fff; | |
font-family: 'Open Sans', Helvetica, sans-serif; | |
-webkit-font-smoothing: antialiased; | |
-moz-osx-font-smoothing: grayscale; | |
} | |
.focus { | |
position: absolute; | |
top: 50%; | |
left: 50%; | |
-webkit-transform: translate(-50%, -50%); | |
transform: translate(-50%, -50%); | |
-webkit-perspective: 500px; | |
perspective: 500px; | |
} | |
.loader { | |
width: 220px; | |
height: 150px; | |
-webkit-transform-style: preserve-3d; | |
transform-style: preserve-3d; | |
-webkit-transform: rotateX(-25deg) rotateY(45deg); | |
transform: rotateX(-25deg) rotateY(45deg); | |
-webkit-transition: all .5s ease-in-out; | |
transition: all .5s ease-in-out; | |
cursor: pointer; | |
} | |
.loader .plane { | |
position: absolute; | |
width: 220px; | |
height: 150px; | |
top: 0; | |
left: 0; | |
background: rgba(0, 0, 0, 0.1); | |
} | |
.loader .bottom { | |
-webkit-transform: rotateX(-90deg) translateZ(110px); | |
transform: rotateX(-90deg) translateZ(110px); | |
background: rgba(46, 204, 113, 0.8); | |
box-shadow: -8px -8px 10px 0 rgba(0, 0, 0, 0.4); | |
-webkit-transition: all .5s ease-in-out; | |
transition: all .5s ease-in-out; | |
} | |
.loader .left { | |
-webkit-transform: rotateY(-90deg) rotateZ(90deg) translateZ(110px); | |
transform: rotateY(-90deg) rotateZ(90deg) translateZ(110px); | |
} | |
.loader .left:before { | |
content: ''; | |
display: block; | |
position: absolute; | |
top: 0; | |
left: 0; | |
right: 0; | |
bottom: 0; | |
background: rgba(46, 204, 113, 0.8); | |
-webkit-transform-origin: 100% 50%; | |
transform-origin: 100% 50%; | |
-webkit-animation: fill2 4s ease-in-out infinite alternate; | |
animation: fill2 4s ease-in-out infinite alternate; | |
} | |
.loader .right { | |
-webkit-transform: rotateY(90deg) rotateZ(90deg) translateZ(110px); | |
transform: rotateY(90deg) rotateZ(90deg) translateZ(110px); | |
} | |
.loader .right:before { | |
content: ''; | |
display: block; | |
position: absolute; | |
top: 0; | |
left: 0; | |
right: 0; | |
bottom: 0; | |
background: rgba(46, 204, 113, 0.8); | |
-webkit-transform-origin: 100% 50%; | |
transform-origin: 100% 50%; | |
-webkit-animation: fill2 4s ease-in-out infinite alternate; | |
animation: fill2 4s ease-in-out infinite alternate; | |
} | |
.loader .back { | |
height: 220px; | |
-webkit-transform: rotateY(180deg) translateY(-35px) translateZ(75px); | |
transform: rotateY(180deg) translateY(-35px) translateZ(75px); | |
} | |
.loader .back:before { | |
content: ''; | |
display: block; | |
position: absolute; | |
top: 0; | |
left: 0; | |
right: 0; | |
bottom: 0; | |
background: rgba(46, 204, 113, 0.8); | |
-webkit-transform-origin: 50% 100%; | |
transform-origin: 50% 100%; | |
-webkit-animation: fill 4s ease-in-out infinite alternate; | |
animation: fill 4s ease-in-out infinite alternate; | |
} | |
.loader .front { | |
height: 220px; | |
-webkit-transform:rotateY(0deg) translateY(-35px) translateZ(75px); | |
transform: rotateY(0deg) translateY(-35px) translateZ(75px); | |
} | |
.loader .front:before { | |
content: ''; | |
display: block; | |
position: absolute; | |
top: 0; | |
left: 0; | |
right: 0; | |
bottom: 0; | |
background: rgba(46, 204, 113, 0.8); | |
-webkit-transform-origin: 50% 100%; | |
transform-origin: 50% 100%; | |
-webkit-animation: fill 4s ease-in-out infinite alternate; | |
animation: fill 4s ease-in-out infinite alternate; | |
} | |
.loader .top { | |
-webkit-transform: rotateX(90deg) translateZ(110px); | |
transform: rotateX(90deg) translateZ(110px); | |
opacity: .5; | |
} | |
@-webkit-keyframes fill { | |
0%,25% { | |
-webkit-transform: scaleY(0); | |
transform: scaleY(0); | |
} | |
75%, 100% { | |
-webkit-transform: scaleY(1); | |
transform: scaleY(1); | |
} | |
} | |
@keyframes fill2 { | |
0%,25% { | |
-webkit-transform: scaleX(0); | |
transform: scaleX(0); | |
} | |
75%, 100% { | |
-webkit-transform: scaleX(1); | |
transform: scaleX(1); | |
} | |
} | |
@keyframes fill { | |
0%,25% { | |
-webkit-transform: scaleY(0); | |
transform: scaleY(0); | |
} | |
75%, 100% { | |
-webkit-transform: scaleY(1); | |
transform: scaleY(1); | |
} | |
} | |
</style> | |
</head> | |
<body> | |
<div class="stage"> | |
<div class="focus"> | |
<div class="loader" onclick="void(0);"> | |
<div class="plane bottom"></div> | |
<div class="plane left"></div> | |
<div class="plane right"></div> | |
<div class="plane back"></div> | |
<div class="plane front"></div> | |
<div class="plane top"></div> | |
</div> | |
</div> | |
</div> | |
</body> | |
</html> |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment