Spinner Alt
2K Views
53 Downloads - 10 API calls
26 Lines - 559 Bytes
Apr 23, 2020 interface shapes
1 @keyframes spinneralt { 2 0% { transform: rotate(0deg ) } 3 to { transform: rotate(359deg ) } 4 } 5 6 .gg-spinner-alt { 7 transform: scale(var(--ggs,1 ))
8 } 9 10 .gg-spinner-alt,
11 .gg-spinner-alt::before { 12 box-sizing: border-box;
13 position: relative;
14 display: block;
15 width: 20px ;
16 height: 20px 17 } 18 19 .gg-spinner-alt::before { 20 content: "";
21 position: absolute;
22 border-radius: 100px ;
23 animation: spinneralt 1s cubic-bezier(.6 ,0 ,.4 ,1 ) infinite;
24 border: 3px solid transparent;
25 border-top-color: currentColor
26 }
1 <svg 2 width="24 " 3 height="24 " 4 viewBox="0 0 24 24 " 5 fill="none" 6 xmlns="http://www.w3 .org/2000 /svg" 7 > 8 <path 9 d="M2 12 C2 6.47715 6.47715 2 12 2 V5 C8.13401 5 5 8.13401 5 12 H2 Z" 10 fill="currentColor" 11 /> 12 </svg>
1 import React from 'react' 2 import styled from 'styled-components' 3 4 const StyledSpinnerAlt = styled.i` 5 @keyframes spinneralt { 6 0% { 7 transform: rotate(0deg );8 } 9 to { 10 transform: rotate(359deg );11 } 12 } 13 & { 14 transform: scale(var(--ggs, 1 ));15 } 16 &, 17 &::before { 18 box-sizing: border-box;19 position: relative;20 display: block;21 width: 20px ;22 height: 20px ;23 } 24 &::before { 25 content: '';26 position: absolute;27 border-radius: 100px ;28 animation: spinneralt 1s cubic-bezier(0.6 , 0 , 0.4 , 1 ) infinite;29 border: 3px solid transparent;30 border-top-color: currentColor;31 } 32 ` 33 34 export const SpinnerAlt = React.forwardRef<HTMLElement, React.HTMLAttributes<HTMLElement>>( 35 (props, ref) => { 36 return ( 37 <> 38 <StyledSpinnerAlt { ...props} ref={ ref} icon-role="spinner-alt" /> 39 </> 40 ) 41 } , 42 ) 43
Spinner Alt is a magic 100% CSS icon built by practicing features as follows: transform, width, height, border-radius, animation, border, border-top-color, Some stats, it has: 26 Lines of code at 559b & 429b after compression. Pretty stunning 🤩 don't you think ?.