Skip to content

Instantly share code, notes, and snippets.

Show Gist options
  • Save eliortabeka/33215f0b8b52d1ce3502 to your computer and use it in GitHub Desktop.
Save eliortabeka/33215f0b8b52d1ce3502 to your computer and use it in GitHub Desktop.
Triangle Loading animation using clip-path
@import "compass/css3";
@import "compass/css3";
$color : hsl(30,11%,94%);
$background : hsl(354,63%,40%);
$duration : 1.25s;
$a : 0 48%, 49% 100%, 100% 48%;
@mixin path($path) {
-webkit-clip-path: polygon($path);
clip-path: polygon($path);
}
html, body {
height: 100%;
}
body {
display: flex;
justify-content: center;
align-items: center;
background: $background;
overflow: hidden;
animation: spin $duration cubic-bezier(1.000, -0.530, 0.405, 1.425) infinite;
}
div {
@include path($a);
width: 100%;
height: 100%;
max-width: 20px;
max-height: 20px;
background: $color;
}
@keyframes spin {
to {
transform: rotate(2turn);
}
}
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment