Pure CSS Radial

A pure CSS Radial Solution

by Stephen Irving

HTML

<div class="load-wrapper">
  <div class="pie-wrapper" data-anim="base wrapper">
    <div class="circle" data-anim="base left"></div>
    <div class="circle" data-anim="base right"></div>
    <!-- Shadow not working :/ <div class="shadow"></div> -->
  </div>
</div>

CSS

/* The basic styling */
.load-wrapper {
  width: 150px;
  height: 150px;
  background-color: lightblue;
  display: flex;
  flex-direction: row;
  align-items: center;
  justify-content: center;
}

.pie-wrapper {
  width: 100px;  /* Sets the width of the progress bar */
  height: 100px; /* Sets the height of the progress bar. Set height equal to width */
  position: absolute; /* Enables clipping */
  clip: rect(0px, 100px, 100px, 50px); /* Hide half of the progress bar */
}

/* Set the sizes of the elements that make up the progress bar */
.circle {
  width: 80px;  /* Set to 80% of wrapper width */
  height: 80px; /* Set to 80% of wrapper width */
  border: 10px solid #58b86b; /* Set to 10% of wrapper width and the color desired */
  border-radius: 50px; /* Set to 50% of wrapper width */
  position: absolute;
  clip: rect(0px, 50px, 100px, 0px);
}

/* Shadow/background radial effect not working 
.pie-wrapper .shadow {
	height: 80px;
	width: 80px;
	border: 10px solid #a7a9ac;
	border-radius: 50px;
  z-index: -1;
  position: relative; 
}
*/


/* Using the data attributes for the animation selectors. */
/* Base settings for all animated elements */
div[data-anim~=base] {
  -webkit-animation-iteration-count: 1;  /* Only run once */
  -webkit-animation-fill-mode: forwards; /* Holds the last keyframe */
  -webkit-animation-timing-function:linear; /* Linear animation */
}

.pie-wrapper[data-anim~=wrapper] {
  -webkit-animation-duration: 0.01s; /* Completes keyframes asap */
  -webkit-animation-delay: 2s; /* Waits half of the animation time */
  -webkit-animation-name: close-wrapper; /* Keyframes name */
}

.circle[data-anim~=left] {
  -webkit-animation-duration: 4s; /* The full animation time */
  -webkit-animation-name: left-spin;
}

.circle[data-anim~=right] {
  -webkit-animation-duration: 2s; /* Set to half the animation time */
  -webkit-animation-name: right-spin;
}

/* Rotate the right side of the progress bar from 0 to 180 degrees */
@-webkit-keyframes right-spin...