Skip to content

Instantly share code, notes, and snippets.

Show Gist options
  • Star 0 You must be signed in to star a gist
  • Fork 0 You must be signed in to fork a gist
  • Save eliortabeka/297e47c87098367227c8 to your computer and use it in GitHub Desktop.
Save eliortabeka/297e47c87098367227c8 to your computer and use it in GitHub Desktop.
Circle Loading animation using clip-path
<div></div>
<div></div>
@import "compass/css3";
@import "compass/css3";
$color : hsl(30,11%,94%);
$background : hsl(24,75%,40%);
$duration : 1.75s;
$a : 40% at 50% 50%;
$b : 25% at 50% 50%;
@mixin path($path) {
-webkit-clip-path: circle($path);
clip-path: circle($path);
}
html, body {
height: 100%;
}
body {
display: flex;
justify-content: center;
align-items: center;
background: $background;
overflow: hidden;
animation: spin $duration ease-in-out infinite;
}
div {
width: 100%;
height: 100%;
max-width: 20px;
max-height: 20px;
background: $color;
animation: loader $duration ease-in-out infinite both;
}
@keyframes loader {
0% {
@include path($a);
}
50% {
@include path($b);
}
100% {
@include path($a);
}
}
@keyframes spin {
to {
transform: rotate(5turn);
}
}
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment