SCSS
@import url(http://fonts.googleapis.com/css?family=Open+Sans);
html, body {
background: #112;
font-family: 'Open Sans', sans-serif;
height: 100vh;
margin: 0;
overflow: hidden;
display: flex;
justify-content: center;
align-items: center;
}
.wrapper {
width: 400px;
height: 300px;
perspective: 1000px;
a {
display: block;
width: 100%;
height: 100%;
background: linear-gradient(rgba(0, 0, 0, 0.4), rgba(0, 0, 0, 0.4)),
url("http://forums.macrumors.com/attachments/pic02-png.620281/");
background-size: 0, cover;
transform-style: preserve-3d;
transition: all 0.5s;
}
}
.wrapper:hover a {
transform: rotateX(80deg);
transform-origin: bottom;
}
.wrapper a:after {
content: '';
position: absolute;
left: 0;
bottom: 0;
width: 100%;
height: 36px;
background: inherit;
background-size: cover, cover;
background-position: bottom;
transform: rotateX(90deg);
transform-origin: bottom;
}
.wrapper a span {
color: white;
text-transform: uppercase;
position: absolute;
top: 100%;
left: 0;
width: 100%;
font: bold 12px/36px "Open Sans";
text-align: center;
transform: rotateX(-89.99deg);
transform-origin: top;
z-index: 1;
}
.wrapper a:before {
content: '';
position: absolute;
top: 0;
left: 0;
width: 100%;
height: 100%;
background: rgba(0, 0, 0, 0.5);
box-shadow: 0 0 100px 50px rgba(0, 0, 0, 0.5);
transition: all 0.5s;
opacity: 0.15;
transform: rotateX(95deg) translateZ(-80px) scale(0.75);
transform-origin: bottom;
}
.wrapper:hover a:before {
opacity: 1;
box-shadow: 0 0 25px 25px rgba(0, 0, 0, 0.5);
transform: rotateX(0) translateZ(-60px) scale(0.85);
}
$time: 20s;
@for $i from 1 through 100 {
.star:nth-child(#{$i}) {
opacity: random();
top: random() * 100%;
position: absolute;
display: block;
width: random() * 2px + 1px;
height: random() * 2px + 1px;
border-radius: 2px;
background-color: #eee;
box-shadow: 0px 0px 5px #eee;
animation: left-right $time + (random() * 2s) (random() * -20s) linear infinite;
}
}
#moon {
transform: translateX(-100px);
position: absolute;
width: 200px;
height: 200px;
display: block;
background-color: #eee;
border-radius: 100px;
animation: left-right $time linear infinite,
down-up $time/2 ease-out infinite alternate,
opacity-in-out $time ease-in-out infinite;
box-shadow: 0px 0px 100px rgba(255, 255, 255, 0.5);
background-image: url('http://science.nasa.gov/media/medialibrary/2009/01/08/08jan_bigmoon2009_resources/Ron-Hodges1.jpg');
background-position: center;
background-size: 140% 140%;
}
@keyframes left-right {
0% { left: 0; }
100% { left: 100%; }
}
@keyframes down-up {
0% { top: 50%; }
100% { top: -50px; }
}
@keyframes opacity-in-out {
0% { opacity: 0; }
10% { opacity: 1; }
90% { opacity: 1; }
100% { opacity: 0; }
}