Pen Settings

HTML

CSS

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. You can use the CSS from another Pen by using it's URL and the proper URL extention.

+ add another resource

JavaScript

Babel includes JSX processing.

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.

+ add another resource

Packages

Add Packages

Search for and use JavaScript packages from npm here. By selecting a package, an import statement will be added to the top of the JavaScript editor for this package.

Behavior

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.

Format on Save

If enabled, your code will be formatted when you actively save your Pen. Note: your code becomes un-folded during formatting.

Editor Settings

Code Indentation

Want to change your Syntax Highlighting theme, Fonts and more?

Visit your global Editor Settings.

HTML

              
                
- for (var i = 1; i < 10; i++) 
  .box
    div(class=`spinner type${i}`)
      span
        | Loading...
              
            
!

CSS

              
                .box{
  position:relative;
  top:10px;
  width:33.33vw;
  height:33.33vw;
  max-width:200px;
  max-height:200px;
  min-width:180px;
  min-height:180px;
  display:inline-block;
  border:1px solid rgba(#fff,.24);
  *{
    letter-spacing:normal;
    white-space:normal;
  }
}

.spinner{
  position:absolute;
  top:50%;
  left:50%;
  transform:translate(-50%, -50%);
  transform-origin:center;
  width:120px;
  height:120px;
  
  // Loading text (Common)
  span{
      position:absolute;
      top:50%;
      left:50%;
      transform:translate(-50%, -50%);
      font-size:12px;
  }
  
  // Spinner 1
  &.type1{
    border-radius:50%;
    border-width:8px;
    border-style:solid;
    border-color:#fff rgba(#fff,.12) rgba(#fff,.12);
    animation:spinner1_1 1.5s infinite linear forwards;

    span{
      animation:spinner_loading_text 1.5s infinite linear forwards reverse;
    }
  }

  // Spinner 2
  &.type2{
    border-radius:50%;
    border-width:4px;
    border-style:solid;
    border-color:#fff transparent;
    animation:spinner1_1 2.2s infinite linear forwards;
    
    &::before{
      content:'';
      position:absolute;
      top:4px;
      left:4px;
      right:4px;
      bottom:4px;
      border-radius:50%;
      border-width:4px;
      border-style:solid;
      border-color:#fff transparent;
      animation:spinner1_2 .8s infinite linear forwards reverse;
    }

    span{
      animation:spinner_loading_text 2.2s infinite linear forwards reverse;
    }
  }
  
  // Spinner 3
  &.type3{
    border-radius:50%;
    border-width:6px;
    border-style:solid;
    border-color:#fff transparent transparent;
    animation:spinner1_1 1.8s infinite linear forwards reverse;
    
    &::before,
    &::after{
      content:'';
      position:absolute;
      top:0;
      left:0;
      width:50%;
      height:50%;
      opacity:0.6;
    }
    &::before{
      transform-origin:right bottom;
      border-right:1px solid;
      z-index:1;
      animation:spinner1_2 .4s infinite linear forwards;
    }
    
    &::after{
      transform-origin:calc(100% - 2px) bottom;
      border-right:4px solid;
      z-index:2;
      animation:spinner3_1 1.5s infinite linear forwards;
    }

    span{
      z-index:3;
      animation:spinner_loading_text 1.8s infinite linear forwards;
    }
  }
  
  // Spinner 4
  &.type4{
    animation:spinner1_1 1.2s infinite linear forwards;
    
    &::before,
    &::after{
      content:'';
      position:absolute;
      top:0;
      left:0;
    }
    
    &::before{
      width:50%;
      height:50%;
      transform-origin:right bottom;
      border-right:1px solid;
      background: linear-gradient(10deg, rgba(#fff, 0) 0%, rgba(#fff, 0.5) 72%, rgba(#fff, 0.6) 100%);
      transform:rotate(45deg);
      z-index:1;
    }
    
    &::after{
      width:100%;
      height:100%;
      border-radius:50%;
      box-shadow:0 -30px #333;
      z-index:2;
    }

    span{
      z-index:3;
      animation:spinner_loading_text 1.2s infinite linear forwards reverse;
    }
  }
  
  // Spinner 5
  &.type5{
    width:20px;
    height:20px;
    border-radius:50%;
    animation:spinner5_1 1.2s infinite linear forwards;
    
    span{
      display:none;
    }
  }
  
  // Spinner 6
  &.type6{
    width:20px;
    height:20px;
    background-color:#fff;
    animation:spinner6_1 1.4s infinite linear forwards;
    
    span{
      display:none;
    }
  }
  
  // Spinner 7
  &.type7{
    width:20px;
    height:20px;
    background-color:#fff;
    animation:spinner7_1 1.4s infinite linear forwards;
    
    span{
      display:none;
    }
  
    &::before,
    &::after{
      content:'';
      position:absolute;
      width:20px;
      height:20px;
      background-color:#fff;
    }
    
    &::before{
      top:-20px;
      left:-20px;
      animation:spinner7_2 1.4s infinite linear forwards;
    }

    &::after{
      top:20px;
      left:20px;
      animation:spinner7_3 1.4s infinite linear forwards;
    }
  }
  
  // Spinner 8
  &.type8{
    width:20px;
    height:20px;
    border-radius:50%;
    animation:spinner8_1 1.4s infinite linear;
    
    span{
      animation:spinner8_loading_text 1.4s infinite linear;
    }
  }
  
  // Spinner 9
  &.type9{
    &::before,
    &::after{
      content:'';
      position:absolute;
      top:50%;
      left:50%;
      transform:translate(-50%, -50%);
      transform-origin:center;
      width:22px;
      height:22px;
      border-radius:50%;
      background-color:rgba(#fff, .2);
    }
    
    &::before{
       animation:spinner9_1 .8s infinite linear;
    }
    &::after{
       animation:spinner9_1 .8s infinite linear reverse;
    }
    
    span{
      display:none;
    }
  }
}

// Spinner animation
@keyframes spinner1_1{
  0%{
    transform:translate(-50%, -50%) rotate(0);
  }
  100%{
    transform:translate(-50%, -50%) rotate(360deg);
  }
}

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

@keyframes spinner3_1{
  0%{
    transform:translateX(2px) translateZ(0) rotate(0deg);
  }
  100%{
    transform:translateX(2px) translateZ(0) rotate(360deg);
  }
}

@keyframes spinner5_1{
  0%{
    opacity:.2;
    box-shadow:0;
    transform:translate(-50%, -50%) rotate(0) scale(.5);
  }
  50%{
    opacity:1;
    box-shadow:21px 21px, -21px -21px, 21px -21px, -21px 21px;
    transform:translate(-50%, -50%) rotate(180deg) scale(1);
  }
  100%{
    opacity:.2;
    box-shadow:0;
    transform:translate(-50%, -50%) rotate(360deg) scale(.5);
  }
}

@keyframes spinner6_1{
  0%{
    box-shadow:0;
    transform:translate(-50%, -50%) rotate(0) scale(.5);
  }
  50%{
    box-shadow:-25px 0, 25px 0, 0 -25px, 0 25px, 25px 25px, -25px -25px, 25px -25px, -25px 25px;
    transform:translate(-50%, -50%) rotate(90deg) scale(1);
    background-color:transparent;
  }
  100%{
    opacity:.5;
    box-shadow:0;
    transform:translate(-50%, -50%) rotate(180deg) scale(.5);
  }
}

@keyframes spinner7_1{
  0%,
  100%{
    background-color:#fff;
  }
  50%{
    background-color:rgba(#fff,0);
  }
}

@keyframes spinner7_2{
  0%,
  100%{
    transform:translate(0, 0) rotateX(0) rotateY(0);
  }
  25%{
    transform:translate(0, calc(100% + 20px)) rotateX(180deg) rotateY(0);
  }
  50%{
    transform:translate(calc(100% + 20px), calc(100% + 20px)) rotateX(180deg) rotateY(180deg);
  }
  75%{
    transform:translate(calc(100% + 20px), 0) rotateX(0deg) rotateY(180deg);
  }
}

@keyframes spinner7_3{
  0%,
  100%{
    transform:translate(0, 0) rotateX(0) rotateY(0);
  }
  25%{
    transform:translate(0, calc(-100% - 20px)) rotateX(-180deg) rotateY(0);
  }
  50%{
    transform:translate(calc(-100% - 20px), calc(-100% - 20px)) rotateX(-180deg) rotateY(-180deg);
  }
  75%{
    transform:translate(calc(-100% - 20px), 0) rotateX(0) rotateY(-180deg);
  }
}

@keyframes spinner8_1{
  0%,
  95%,
  100%{
    box-shadow:-28px -28px transparent, 0 -28px transparent, 28px -28px transparent, -28px 0 transparent, 28px 0 transparent, -28px 28px transparent, 0 28px transparent, 28px 28px transparent;
  }
  5%{
    box-shadow:-28px -28px, 0 -28px transparent, 28px -28px transparent, -28px 0 transparent, 28px 0 transparent, -28px 28px transparent, 0 28px transparent, 28px 28px transparent;
  }
  10%{
    box-shadow:-28px -28px, 0 -28px, 28px -28px transparent, -28px 0 transparent, 28px 0 transparent, -28px 28px transparent, 0 28px transparent, 28px 28px transparent;
  }
  15%{
    box-shadow:-28px -28px, 0 -28px, 28px -28px, -28px 0 transparent, 28px 0 transparent, -28px 28px transparent, 0 28px transparent, 28px 28px transparent;
  }
  20%{
    box-shadow:-28px -28px, 0 -28px, 28px -28px, -28px 0, 28px 0 transparent, -28px 28px transparent, 0 28px transparent, 28px 28px transparent;
    background-color:transparent;
  }
  25%{
    box-shadow:-28px -28px, 0 -28px, 28px -28px, -28px 0, 28px 0 transparent, -28px 28px transparent, 0 28px transparent, 28px 28px transparent;
    background-color:#fff;
  }
  30%{
    box-shadow:-28px -28px, 0 -28px, 28px -28px, -28px 0, 28px 0, -28px 28px transparent, 0 28px transparent, 28px 28px transparent;
  }
  35%{
    box-shadow:-28px -28px, 0 -28px, 28px -28px, -28px 0, 28px 0, -28px 28px, 0 28px transparent, 28px 28px transparent;
  }
  40%{
    box-shadow:-28px -28px, 0 -28px, 28px -28px, -28px 0, 28px 0, -28px 28px, 0 28px, 28px 28px transparent;
  }
  45%,
  50%{
    box-shadow:-28px -28px, 0 -28px, 28px -28px, -28px 0, 28px 0, -28px 28px, 0 28px, 28px 28px;
  }
  55%{
    box-shadow:-28px -28px transparent, 0 -28px, 28px -28px, -28px 0, 28px 0, -28px 28px, 0 28px, 28px 28px;
  }
  60%{
    box-shadow:-28px -28px transparent, 0 -28px transparent, 28px -28px, -28px 0, 28px 0, -28px 28px, 0 28px, 28px 28px;
  }
  65%{
    box-shadow:-28px -28px transparent, 0 -28px transparent, 28px -28px transparent, -28px 0, 28px 0, -28px 28px, 0 28px, 28px 28px;
  }
  70%{
    box-shadow:-28px -28px transparent, 0 -28px transparent, 28px -28px transparent, -28px 0 transparent, 28px 0, -28px 28px, 0 28px, 28px 28px;
    background-color:#fff;
  }
  75%{
    box-shadow:-28px -28px transparent, 0 -28px transparent, 28px -28px transparent, -28px 0 transparent, 28px 0, -28px 28px, 0 28px, 28px 28px;
    background-color:transparent;
  }
  80%{
    box-shadow:-28px -28px transparent, 0 -28px transparent, 28px -28px transparent, -28px 0 transparent, 28px 0 transparent, -28px 28px, 0 28px, 28px 28px;
  }
  85%{
    box-shadow:-28px -28px transparent, 0 -28px transparent, 28px -28px transparent, -28px 0 transparent, 28px 0 transparent, -28px 28px transparent, 0 28px, 28px 28px;
  }
  90%{
    box-shadow:-28px -28px transparent, 0 -28px transparent, 28px -28px transparent, -28px 0 transparent, 28px 0 transparent, -28px 28px transparent, 0 28px transparent, 28px 28px;
  }
}

@keyframes spinner9_1{
  0%{
    transform:translate(-50%, -50%) scale(1) ;
  }
  100%{
    transform:translate(-50%, -50%) scale(2.8);
  }
}

@keyframes spinner8_loading_text{
  0%{
    transform:translate(-50%, -50%);
  }
  50%{
    transform:translate(-50%, calc(-50% + 32px));
    opacity:0;
  }
  50.1%{
    transform:translate(-50%, calc(-50% - 32px));
    opacity:0;
  }
  100%{
    transform:translate(-50%, -50%);
    opacity:1;
  }
}

@keyframes spinner_loading_text{
  0%{
    opacity:1;
    transform:translate(-50%, -50%) rotate(0deg);
  }
  50%{
    opacity:0;
    transform:translate(-50%, -50%) rotate(180deg);
  }
  100%{
    opacity:1;
    transform:translate(-50%, -50%) rotate(360deg);
  }
}
              
            
!

JS

              
                
              
            
!
999px

Console