cssAudio - Activefile-genericCSS - ActiveGeneric - ActiveHTML - ActiveImage - ActiveJS - ActiveSVG - ActiveText - Activefile-genericVideo - ActiveLovehtmlicon-new-collectionicon-personicon-teamlog-outoctocatpop-outspinnerstartv

Quite perfect CSS circle filling

A Pen By Captain Anonymous

Pen Settings

CSS Base

Vendor Prefixing

Add External Stylesheets/Pens

Any URL's added here will be added as <link>s in order, and before the CSS in the editor. If you link to another Pen, it will include the CSS from that Pen. If the preprocessor matches, it will attempt to combine them before processing.

Quick-add: + add another resource

Add External Scripts/Pens

Any URL's added here will be added as <script>s in order, and run before the JavaScript in the editor. You can use the URL of any other Pen and it will include the JavaScript from that Pen.

Quick-add: + add another resource

Code Indentation

     

Save Automatically?

If active, Pens will autosave every 30 seconds after being saved once.

Auto-Updating Preview

If enabled, the preview panel updates automatically as you code. If disabled, use the "Run" button to update.

            
              <div class="wrapper">
  <div class="pie spinner"></div>
  <div class="pie filler"></div>
  <div class="mask"></div>
</div>​ 
            
          
!
            
              @import "compass/css3";

/* 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; }
} 
            
          
!
999px
Loading ..................

Console