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

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.

+ add another resource

You're using npm packages, so we've auto-selected Babel for you here, which we require to process imports and make it all work. If you need to use a different JavaScript preprocessor, remove the packages in the npm tab.

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

Use npm Packages

We can make npm packages available for you to use in your JavaScript. We use webpack to prepare them and make them available to import. We'll also process your JavaScript with Babel.

⚠️ This feature can only be used by logged in users.

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.

            
              .loader
  - for(i=0; i < 8; i++)
    .side
            
          
!
            
              body
  font-family: "Lato"
  background: #EFECCA
  color: #1d1d1d
  margin: 0
  padding: 0

$side-length = 20px
$side-width = 6px
$side-color = #046380
$loader-size = $side-length * (1 + math(2, 'sqrt'))

$anim-duration = 1.5s
$anim-offset = 0

.loader
  position: absolute
  left: 50%
  top: 50%
  width: $loader-size
  height: $loader-size
  margin-left: ($loader-size / -2)
  margin-top: ($loader-size / -2)
  border-radius: 100%
  animation-name: loader
  animation-iteration-count: infinite
  animation-timing-function: linear
  animation-duration: 4s

  .side
    display: block
    width: $side-width
    height: $side-length
    background-color: $side-color
    margin: 2px
    position: absolute
    border-radius: 50%
    animation-duration: $anim-duration
    animation-iteration-count: infinite
    animation-timing-function: ease

    // &:before, &:after
    //   content: ""
    //   position: absolute
    //   border-style: solid
    // &:before
    //   top: ($side-width * -1)
    //   border-width: 0 0 $side-width $side-width
    //   border-color: transparent transparent $side-color transparent
    // &:after
    //   top: $side-length
    //   border-width: 0 $side-width $side-width 0
    //   border-color: transparent $side-color transparent transparent

    &:nth-child(1), &:nth-child(5)
      transform: rotate(0deg)
      animation-name: rotate0
    &:nth-child(3), &:nth-child(7)
      transform: rotate(90deg)
      animation-name: rotate90
    &:nth-child(2), &:nth-child(6)
      transform: rotate(45deg)
      animation-name: rotate45
    &:nth-child(4), &:nth-child(8)
      transform: rotate(135deg)
      animation-name: rotate135

  for count in (0..7)
    .side:nth-child({count + 1})
      $side-offset = ($side-width / 2) * count
      $dotval = ($loader-size / 2)

      top: sin(45deg * count) * $dotval + $dotval
      left: cos(45deg * count) * $dotval + $dotval
      margin-left: ($side-width / -2)
      margin-top: ($side-length / -2)
      animation-delay: $anim-offset * count

// side keyframes
@keyframes rotate0
  0%
    transform: rotate(0deg)
  60%
    transform: rotate(180deg)
  100%
    transform: rotate(180deg)

@keyframes rotate90
  0%
    transform: rotate(90deg)
  60%
    transform: rotate(270deg)
  100%
    transform: rotate(270deg)

@keyframes rotate45
  0%
    transform: rotate(45deg)
  60%
    transform: rotate(225deg)
  100%
    transform: rotate(225deg)

@keyframes rotate135
  0%
    transform: rotate(135deg)
  60%
    transform: rotate(315deg)
  100%
    transform: rotate(315deg)

// loader keyframe
@keyframes loader
  0%
    transform: rotate(0deg)
  100%
    transform: rotate(360deg)

            
          
!
999px
🕑 One or more of the npm packages you are using needs to be built. You're the first person to ever need it! We're building it right now and your preview will start updating again when it's ready.
Loading ..................

Console