Space
Space
by Dru Dro
HTML
<div class="space-body sun"></div>
<div class="space-body earth"></div>
CSS
html, body {
position:relative;
margin: 0;
padding: 0;
width: 100%;
height: 100%;
z-index: 0;
}
body {
background-color: #000;
background-image: url(http://www.gimpusers.com/system/tutorial_steps/839/13-original.png);
overflow: hidden;
}
.space-body {
position:absolute;
width:100px;
height: 100px;
margin-top: -25px;
margin-left: -25px;
left: 50%;
top: 50%;
border-radius: 100%;
z-index: 0;
}
.space-body.earth {
width:50px;
height: 50px;
background: url(https://upload.wikimedia.org/wikipedia/commons/6/6b/Planet_Terrestrial_Earth_Animated.gif) no-repeat center;
animation: anim 120s linear infinite;
}
.space-body.sun {
background: url(https://media.giphy.com/media/x7plV6bC5IWOc/giphy.gif) no-repeat center;
background-size: 130px;
animation: none;
box-shadow: -10px 10px 250px 0 rgba(255,255,250,1),0 0 50px 0 rgba(0,0,0,.1) inset,50px -50px 50px 0 rgba(255,255,200,.3) inset;
}
@keyframes anim {
0% {transform: translateX(0) scale(.1); z-index: -1}
12.5% {transform: translateX(-200px) scale(.5)}
25% {transform: translateX(-400px) scale(1)}
37.5% {transform: translateX(-200px) scale(3)}
50% {transform: translateX(0) scale(4); z-index: 1;}
62.5% {transform: translateX(200px) scale(3)}
75% {transform: translateX(400px) scale(1)}
87.5% {transform: translateX(200px) scale(.5)}
100% {transform: translateX(0) scale(.1); z-index: -1}
}