Skip to content

Instantly share code, notes, and snippets.

@devuri
Created August 4, 2020 19:19
Show Gist options
  • Select an option

  • Save devuri/12d6d22135bbee7dccf0d23c6205c950 to your computer and use it in GitHub Desktop.

Select an option

Save devuri/12d6d22135bbee7dccf0d23c6205c950 to your computer and use it in GitHub Desktop.
Simple SCSS Loading Spinner with step() Animation
.loader
- 1..12.times do
.prong
.inner

Simple SCSS Loading Spinner with step() Animation

Appropriately enough, literally built while waiting for my CI tests to run 😂

A Pen by Uriel Wilson on CodePen.

License.

body {
min-height: 100vh;
display: flex;
justify-content: center;
align-items: center;
}
.loader {
width: 200px;
height: 200px;
border-radius: 200px;
position: relative;
animation: rotate 0.8s steps(12, end) infinite;
.prong {
position: absolute;
height: 50%;
width: 16px;
left: calc(50% - 8px);
transform-origin: bottom;
.inner {
background: #34657f;
border-radius: 12px;
position: absolute;
width: 100%;
top: 0;
height: 50%;
}
@for $i from 1 through 12 {
&:nth-of-type(#{$i}) {
opacity: $i * 0.08;
transform: rotate($i * 30deg);
}
}
}
}
@keyframes rotate {
from {
transform: rotate(0deg);
}
to {
transform: rotate(360deg);
}
}
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment