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.

Quick-add: + add another resource

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.

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.

            
              <Saturn>
  <Ring top></Ring>
  <Ring bottom></Ring>
  <Ring top></Ring>
  <Ring bottom></Ring>
  <Ring top></Ring>
  <Ring bottom></Ring>
  <PlanetBody top></PlanetBody>
  <PlanetBody bottom></PlanetBody>
</Saturn>
            
          
!
            
              $size: 240px;
$stars: 60;
$rings: (
  (
    size: 2.5,
    border: 5px,
    color: #685B50
  ), (
    size: 2.45,
    border: 30px,
    color: #7D6B5F
  ), (
    size: 2.1,
    border: 70px,
    color: #8F7C6D
  )
);

@mixin clip ($type, $amount: 1) {
  @if $type == "top" {
    clip: rect(
      0,
      $size * $amount,
      $size / 2 * ($amount + .25),
      0
    );
  }
  @if $type == "bottom" {
    clip: rect(
      $size / 2 * ($amount - .25),
      $size * $amount,
      $size * $amount,
      0
    );
  }
}

@keyframes wink {
  0% {
    opacity: 1;
    box-shadow: 0 0 3px rgba(#fff, .5);
  }
  46% {
    opacity: .5;
    box-shadow: none;
  }
  49% {
    opacity: 1;
    box-shadow: 0 0 5px rgba(#fff, .5);
  }
  52% {
    opacity: .6;
    box-shadow: 0 0 3px rgba(#fff, .5);
  }
  55% {
    opacity: 1;
    box-shadow: none;
  }
  100% {
    opacity: 1;
    box-shadow: 0 0 3px rgba(#fff, .5);
  }
}

html, body {
  width: 100%;
  height: 100%;
}

body {
  display: flex;
  justify-content: center;
  align-items: center;
  background: #2a2f38;
  transition: all 1s;
}

.star {
  position: absolute;
  width: 2px;
  height: 2px;
  transform: rotate(45deg);
  transition: all 1s;
  animation: wink 5s infinite;
  
  @for $i from 1 through $stars {
    $bg: rgba(#fff, .3 + $i / $stars);
    &:nth-of-type(#{$i}) {
      background: $bg;
      animation-delay: #{$i / 3}s;
    }
  }
}

Saturn {
  width: $size;
  height: $size;
  position: relative;
  z-index: 1;
  transition: all 1s;
  
  PlanetBody, Ring {
    position: absolute;
    top: 50%;
    left: 50%;
    border-radius: 100%;
    box-sizing: border-box;
  }
  
  PlanetBody {
    width: 100%;
    height: 100%;
    transform: translate(-50%, -50%);
    background: #F7C882;
    
    &[top] {
      @include clip("top");
      background:
        linear-gradient(
          to bottom,
          #6A6357 5%,
          #99886A 6%,
          #99886A 10%,
          #CDB487 11%,
          #CDB487 13%,
          #C9A970 14%,
          #C9A970 27%,
          #C6A062 30%,
          #C6A062 35%,
          #EDC37B 38%,
          #EDC37B 50%
        )
    }
    
    &[bottom] {
      @include clip("bottom");
      background:
        linear-gradient(
          to top,
          #99886A 10%,
          #C9A970 14%,
          #C9A970 27%,
          #C6A062 30%,
          #C6A062 35%,
          #EDC37B 38%,
          #EDC37B 50%
        )
    }
  }
  
  Ring {
    transition: all 1s;
    transform:
      translate(-50%, -50%)
      rotateX(75deg);
    
    &[bottom] {
      z-index: 1;
    }
    
    $l: length($rings);
    @for $i from 1 through $l {
      $j:      $i * 2 - 1;
      $ring:   nth($rings, $i);
      $mass:   map-get($ring, size);
      $border: map-get($ring, border);
      $color:  map-get($ring, color);
      
      &[top]:nth-of-type(#{$j}),
      &[bottom]:nth-of-type(#{$j + 1}) {
        width: $size * $mass;
        height: $size * $mass;
        border: $border solid;
        color: $color;
      }
        
      &[top]:nth-of-type(#{$j}) {
        @include clip("top", $mass);
      }
        
      &[bottom]:nth-of-type(#{$j + 1}) {
        @include clip("bottom", $mass);
      }
    }
  }
}

body:hover {
  background: #1a1f28;
  
  Saturn {
    transform:
      scale(1.25)
      rotate(-5deg);

    Ring {
      transform:
        translate(-50%, -50%)
        rotateX(60deg)
    }
  }
}
            
          
!
            
              function nJoin(n, cb) {
  return new Array(n)
    .join(' ')
    .split(' ')
    .map(cb)
    .join('')
}

var w = window.innerWidth
var h = window.innerHeight

var stars = nJoin(60, e => {
  var top = Math.random() * h
  var left = Math.random() * w
  var style = `
    top: ${top}px;
    left: ${left}px;
  `
  return `
    <span
      class="star"
      style="${style}">
    </span>
  `
})
document.body.innerHTML += stars
            
          
!
999px
Loading ..................

Console