CodePen

HTML

            
              <div class="wrapper">
  <div class="pie spinner"></div>
  <div class="pie filler"></div>
  <div class="mask"></div>
</div>​ 
            
          
!
via HTML Inspector

CSS

            
              /* This variable set the animation duration. */
$animation-duration : 10s;

* { box-sizing:border-box; }

/* The whole thing is responsive. Just make sure to specify both width and height on the parent element, and more importantly, make sure both values are the same. */ 
.wrapper { 
  width:250px;
  height:250px;
  margin:50px auto;
  position:relative; /* Allows absolute positionning for children. */
  background:white; 
}

.pie {
  /* Don't change anything */
  width: 50%;
  height: 100%;
  transform-origin: 100% 50%;
  position: absolute;
    
  /* Change what you want there */
  background: #08C;
  border: 20px solid rgba(0,0,0,0.4);
}

.spinner {
/* Thanks @Joshua Hibbert for the border-radius trick */
  background: #555;
  border-radius: 100% 0 0 100% / 50% 0 0 50%;
  z-index: 200;
    
  /* Change the border if you want */
  border-right:none;
    
  /* If you want to change the rotation duration, make sure to change it on the 3 animation properties and more importantly, make sur the 3 values are the same */
  animation: rota $animation-duration linear infinite;
}

/* You can pause the animation by hovering it, pretty neat huh ? */

.wrapper:hover .spinner,
.wrapper:hover .filler, 
.wrapper:hover .mask {
    animation-play-state: paused;    
}

/* You can put element on the circle, it works pretty fine. Try enabling this block of code to see it in action. */
/*
.spinner:after {
    position:absolute;
    width:10px;
    height:10px;
    background:#fff;
    border:1px solid rgba(0,0,0,0.5);
    box-shadow: inset 0 0 3px rgba(0,0,0,0.2);
    border-radius:50%;
    top:10px;
    right:10px;   
    content:"";
}*/

.filler {
  border-radius: 0 100% 100% 0 / 0 50% 50% 0; 
  left: 50%;
  opacity: 0;
  z-index: 100;
  animation: fill $animation-duration steps(1,end) infinite;
    
  border-left: none;
}

.mask {
  /* Don't change anything */
  width: 50%;
  height: 100%;
  position: absolute;
  background: #ccc;
  opacity: 1;
  z-index: 300;
  animation: mask $animation-duration steps(1,end) infinite;
}

@keyframes rota {
  0% { transform: rotate(0deg); }
  100% { transform: rotate(360deg); }
}

@keyframes mask {
  0% { opacity: 1; }
  50%, 100% { opacity: 0; }
}

@keyframes fill {
  0% { opacity: 0; }
  50%, 100% { opacity: 1; }
} 
            
          
!
? ?
? ?
Must be a valid URL.
+ add another resource
via CSS Lint

JS

            
              
            
          
!
Must be a valid URL.
+ add another resource
via JS Hint
Loading ..................