Created
November 29, 2016 10:08
-
-
Save pavermakov/b485a6d2c2fab1a70949bf757345b09f to your computer and use it in GitHub Desktop.
Spinner loading animation
This file contains hidden or 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"> | |
<title>CSS ui</title> | |
<style> | |
* { | |
box-sizing: border-box; | |
} | |
body { | |
font-family: Palanquin; | |
line-height: 1.618em; | |
background: #3498db; | |
color: #fff; | |
} | |
.wrapper { | |
max-width: 50rem; | |
width: 100%; | |
margin: 5rem auto; | |
text-align: center; | |
} | |
.spinner { | |
position: relative; | |
width: 6rem; | |
height: 6rem; | |
margin: 6rem auto; | |
} | |
div[class^='curve_'] { | |
position: absolute; | |
transform: rotate(135deg); | |
animation: spin 4s infinite; | |
} | |
.curve_top_left{ | |
width: 3rem; | |
height: 3rem; | |
border-top: 0.5rem solid #fff; | |
border-left: 0.5rem solid #fff; | |
border-top-left-radius: 200%; | |
top: 0; | |
left: 0; | |
transform-origin: 100% 100%; | |
} | |
.curve_bottom_right { | |
width: 3rem; | |
height: 3rem; | |
border-bottom: 0.5rem solid #fff; | |
border-right: 0.5rem solid #fff; | |
border-bottom-right-radius: 200%; | |
bottom: 0; | |
right: 0; | |
transform-origin: 0 0; | |
} | |
.curve_top_right { | |
width: 2rem; | |
height: 2rem; | |
border-top: 0.5rem solid #fff; | |
border-right: 0.5rem solid #fff; | |
border-top-right-radius: 200%; | |
top: 1rem; | |
right: 1rem; | |
transform-origin: 0 100%; | |
} | |
.curve_bottom_left { | |
width: 2rem; | |
height: 2rem; | |
border-bottom: 0.5rem solid #fff; | |
border-left: 0.5rem solid #fff; | |
border-bottom-left-radius: 200%; | |
bottom: 1rem; | |
left: 1rem; | |
transform-origin: 100% 0; | |
} | |
.center_circle { | |
width: 1.5rem; | |
height: 1.5rem; | |
background: #fff; | |
border-radius: 50%; | |
position: absolute; | |
top: 2.25rem; | |
left: 2.25rem; | |
animation: pulse 2s infinite; | |
} | |
@keyframes spin { | |
0% { | |
transform: rotate(135deg); | |
opacity: 1; | |
} | |
25% { | |
opacity: 0.75; | |
} | |
50% { | |
transform: rotate(675deg); | |
opacity: 1; | |
} | |
75% { | |
opacity: 0.75; | |
} | |
100% { | |
transform: rotate(135deg); | |
opacity: 1; | |
} | |
} | |
@keyframes pulse { | |
0% { | |
opacity: 1; | |
} | |
50% { | |
opacity: 0.5; | |
} | |
100% { | |
opacity: 1; | |
} | |
} | |
</style> | |
</head> | |
<body> | |
<div class="wrapper"> | |
<div class="spinner"> | |
<div class="curve_top_left"></div> | |
<div class="curve_bottom_right"></div> | |
<div class="curve_top_right"></div> | |
<div class="curve_bottom_left"></div> | |
<div class="center_circle"></div> | |
</div> | |
</div> | |
</body> | |
</html> |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment