cssAudio - ActiveCSS - ActiveGeneric - ActiveHTML - ActiveImage - ActiveJS - ActiveSVG - ActiveText - Activefile-genericVideo - Activehtmlicon-personicon-teamoctocatspinnerstartv

Pen Settings

CSS Base

Vendor Prefixing

Add External CSS

These stylesheets will be added in this order and before the code you write in the CSS editor. You can also add another Pen here, and it will pull the CSS from it. Try typing "font" or "ribbon" below.

Quick-add: + add another resource

Add External JavaScript

These scripts will run in this order and before the code in the JavaScript editor. You can also link to another Pen here, and it will run the JavaScript from it. Also try typing the name of any popular library.

Quick-add: + add another resource

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.

            
              .container
  - (1...57).each do |c|
    .dot
      / .inner is necessary to allow rotation in addition to translate
      .inner 
            
          
!
            
              $n: 56;  /* Number of elements (one less than in Haml) */
$t: 2;   /* Animation duration in seconds */
$r: 5;   /* Radius of a circle in percent */
$moveDistance: 300%; /* The percent of the radius that each dot moves in an animation */

$fullPercent: 70%; /* The keyframe at which the dots reach full size */
$scale: 0.55; /* Max of total size scaled to in animation */

$a: floor($n / 4); /* Divides dots into circles */

html, body { height: 100%; margin: 0; }
body { background-color: black; }
.container {
  position: relative;
  max-width: 100vh;
  max-height: 100%;
  margin: 0 auto;
  overflow: hidden;
  &:before {
    content: "";
    display: block;
    margin-top: 100%;
  }
}
.dot {
  width: $r * 2%;
  height: $r * 2%;
  position: absolute;
  left: 50% - $r;
  top: 50% - $r;  
  .inner {
    width: 100%;
    height: 100%;
    animation: move #{$t}s linear infinite;
    
    &::after {
      content: '';
      display: block;
      width: 100%;
      height: 100%;
      border-radius: 50%;
      animation: scale #{$t}s linear infinite;
    }
  }
}

@for $i from 1 to $n {
  .dot:nth-of-type(#{$i}) {
    transform: rotate(-360deg * $i/$a);
    .inner {
      animation-delay: -#{$t * $i/$n}s;
      &::after {
        animation-delay: -#{$t * $i/$n}s;
      }
    }
  }
}

@keyframes move {
  to { transform: translateX($moveDistance); }
}

@keyframes scale {
  /* Scale */
  0%, 100% { transform: scale(0); }
  #{$fullPercent} { transform: scale($scale); }
  
  /* Colors */
  /* Offset to not stop transforms */
  @for $i from 0 through 10 {
    @if $i < 10 {
      $scaler: $i * 10;
      #{$scaler + 0.001%} {
        background: hsl(360 * $scaler / 100, 80%, 55%); 
      }
    }
    @else {
      99.999% {
        background: hsl(360, 80%, 55%); 
      }
    }
  }
}
            
          
!
999px
Close

Asset uploading is a PRO feature.

As a PRO member, you can drag-and-drop upload files here to use as resources. Images, Libraries, JSON data... anything you want. You can even edit them anytime, like any other code on CodePen.

Go PRO

Loading ..................

Console