Created
July 1, 2016 04:17
-
-
Save Stahlneckr/c1e1cf5bad4b75958479937128aa99f7 to your computer and use it in GitHub Desktop.
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
| <div class="wrapper"> | |
| <div class="pie spinner"></div> | |
| <div class="pie filler"></div> | |
| <div class="mask"></div> | |
| </div> | |
| @mixin timer($item, $duration, $size, $color, $border, $hover: running) { | |
| #{$item}, #{$item} * { @include box-sizing(border-box); } | |
| | |
| #{$item} { | |
| width: $size; | |
| height: $size; | |
| } | |
| | |
| #{$item} .pie { | |
| width: 50%; | |
| height: 100%; | |
| transform-origin: 100% 50%; | |
| position: absolute; | |
| background: $color; | |
| border: #{$border}; | |
| } | |
| | |
| #{$item} .spinner { | |
| border-radius: 100% 0 0 100% / 50% 0 0 50%; | |
| z-index: 200; | |
| border-right: none; | |
| animation: rota $duration + s linear infinite; | |
| } | |
| | |
| #{$item}:hover .spinner, | |
| #{$item}:hover .filler, | |
| #{$item}:hover .mask { | |
| animation-play-state: $hover; | |
| } | |
| | |
| #{$item} .filler { | |
| border-radius: 0 100% 100% 0 / 0 50% 50% 0; | |
| left: 50%; | |
| opacity: 0; | |
| z-index: 100; | |
| animation: opa $duration + s steps(1,end) infinite reverse; | |
| border-left: none; | |
| } | |
| | |
| #{$item} .mask { | |
| width: 50%; | |
| height: 100%; | |
| position: absolute; | |
| background: inherit; | |
| opacity: 1; | |
| z-index: 300; | |
| animation: opa $duration + s steps(1,end) infinite; | |
| } | |
| | |
| @keyframes rota { | |
| 0% { transform: rotate(0deg); } | |
| 100% { transform: rotate(360deg); } | |
| } | |
| | |
| @keyframes opa { | |
| 0% { opacity: 1; } | |
| 50%, 100% { opacity: 0; } | |
| } | |
| } |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment