Skip to content

Instantly share code, notes, and snippets.

@mcanthony
Created October 5, 2015 04:05
Show Gist options
  • Save mcanthony/52b622d49b4a2bc680f8 to your computer and use it in GitHub Desktop.
Save mcanthony/52b622d49b4a2bc680f8 to your computer and use it in GitHub Desktop.
Simple rotating loader
@backgroundColor: hsl(220, 3%, 95%);
@activeColor: hsl(220, 2%, 50%);
html, body {
width: 100%;
height: 100%;
background: @backgroundColor;
}
.loader {
width: 200px;
height: 200px;
position: absolute;
top: 50%;
left: 50%;
background: @activeColor;
border-radius: 400px;
-webkit-clip-path: polygon(0% 50%, 100% 50%, 100% 100%, 0% 100%);
clip-path: polygon(0% 50%, 100% 50%, 100% 100%, 0% 100%);
animation: rotate 1s infinite linear;
transition: all .25s ease-in-out;
&:hover {
background: red;
}
&:before {
z-index: 1;
content: '';
display: block;
position: absolute;
width: 100%;
height: 100%;
border-radius: 100%;
background: @backgroundColor;
left: 6%;
top: 1%;
}
}
@keyframes rotate {
0% {
transform: translate(-50%, -50%) rotate(0deg);
}
100% {
transform: translate(-50%, -50%) rotate(360deg);
}
}
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment