Wait Spinner SVG Animation

by Ben Clayton

HTML

<div class='wait_spinner'>
			<div title='Loading...' class='spinner2020 smallerx'>
				<svg viewBox='0 0 100 100' xmlns='http://www.w3.org/2000/svg'>
					<circle cx='50' cy='50' r='45'/>
				</svg>
			</div>
		</div>

CSS

body {

  background-color: black;
}



/* SVG styles.*/
.spinner2020 svg {
  animation: 2s linear infinite svg-animation;
  max-width: 100px;
}

.spinner2020.smaller svg {
  animation: 2s linear infinite svg-animation;
  max-width: 25px;
}

/* SVG animation.*/
@keyframes svg-animation {
  0% {
    transform: rotateZ(0deg);
  }
  100% {
    transform: rotateZ(360deg);
  }
}

/* Circle styles. */
.spinner2020 circle {
  animation: 1.4s ease-in-out infinite both circle-animation;
  display: block;
  fill: transparent;
  stroke: #f3e112;
  stroke-linecap: round;
  stroke-dasharray: 283;
  stroke-dashoffset: 280;
  stroke-width: 10px;
  transform-origin: 50% 50%;
}

/* Circle animation. */
@keyframes circle-animation {
  0%,
  25% {
    stroke-dashoffset: 280;
    transform: rotate(0);
  }

  50%,
  75% {
    stroke-dashoffset: 75;
    transform: rotate(45deg);
  }

  100% {
    stroke-dashoffset: 280;
    transform: rotate(360deg);
  }
}