Created
July 3, 2015 09:14
-
-
Save votemike/d1eeac9ca64f38a6f8f2 to your computer and use it in GitHub Desktop.
Shining sun in pure CSS/HTML, no images
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
body { | |
background-color: deepskyblue; | |
padding: 10px; | |
} | |
div.sunholder { | |
display: inline-block; | |
animation: spin 8s linear 0s infinite; | |
} | |
div.sun { | |
display: block; | |
height: 50px; | |
width: 50px; | |
background-color: yellow; | |
border-radius: 50%; | |
} | |
div.raybase { | |
position: absolute; | |
top: 19px; /*50px/2-6px*/ | |
left: 19px; /*(50px-12px)/2*/ | |
} | |
div.ray { | |
display: block; | |
width: 0; | |
height: 0; | |
border-top: 6px solid transparent; | |
border-bottom: 6px solid transparent; | |
border-left: 12px solid yellow; | |
animation: shine 1s linear 0s infinite alternate; | |
} | |
div.ray1 { | |
transform: translate(28px,0px); /*(50px+6px)/2*/ | |
} | |
div.ray2 { | |
transform: rotate(45deg) translate(28px,0px) ; | |
} | |
div.ray3 { | |
transform: rotate(90deg) translate(28px,0px) ; | |
} | |
div.ray4 { | |
transform: rotate(135deg) translate(28px,0px) ; | |
} | |
div.ray5 { | |
transform: rotate(180deg) translate(28px,0px) ; | |
} | |
div.ray6 { | |
transform: rotate(225deg) translate(28px,0px) ; | |
} | |
div.ray7 { | |
transform: rotate(270deg) translate(28px,0px) ; | |
} | |
div.ray8 { | |
transform: rotate(315deg) translate(28px,0px) ; | |
} | |
@keyframes spin { | |
from { transform: rotate(0deg); } | |
to { transform: rotate(360deg); } | |
} | |
@keyframes shine { | |
from { transform: translate(0px,0px) } | |
to { transform: translate(5px,0px) } | |
} |
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> | |
<head> | |
<link rel="stylesheet" type="text/css" href="sun.css"> | |
<meta charset="utf-8"> | |
<title>Sun</title> | |
</head> | |
<body> | |
<div class="sunholder"> | |
<div class="sun"></div> | |
<div class="raybase ray1"><div class="ray"></div></div> | |
<div class="raybase ray2"><div class="ray"></div></div> | |
<div class="raybase ray3"><div class="ray"></div></div> | |
<div class="raybase ray4"><div class="ray"></div></div> | |
<div class="raybase ray5"><div class="ray"></div></div> | |
<div class="raybase ray6"><div class="ray"></div></div> | |
<div class="raybase ray7"><div class="ray"></div></div> | |
<div class="raybase ray8"><div class="ray"></div></div> | |
</div> | |
</body> | |
</html> |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment