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. 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

JavaScript

Babel is required to process package imports. If you need a different preprocessor remove all packages first.

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

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

              
                mixin cube
  .cube
    .face.x
    .face.y
    .face.z
    
.view
  .plane.main
    +cube  
              
            
!

CSS

              
                $side: 150px
$duration: 4s
$scale: 3

$stops: (#1DB4F7 0%, #24D8FE 20%, #1BAD58 40%, #79DE4F 60%, #FFFFFF 80%, #1DB4F7 100%)

@mixin frames($frames)
  @each $frame in $frames
    #{nth($frame, 2)}
      background: nth($frame, 1)


@mixin plane($w, $h)
  width: $w
  height: $h
  transform-style: preserve-3d
  
@mixin cube($side)
  transform-style: preserve-3d
  font-size: $side
  width: 1em
  height: 1em

  .face
    position: absolute
    box-sizing: border-box
    transform-style: preserve-3d
    width: 100%
    height: 100%
    
    &::after,
    &::before
      content: ''
      display: block
      position: absolute
      width: 100%
      height: 100%

    &::before
      transform: translateZ(-$side/2)

    &::after
      transform: translateZ($side/2)

    &.x
      transform: rotateX(90deg)
    &.y
      transform: rotateY(90deg) rotateZ(90deg)
  
@mixin view($p)
  position: absolute
  top: 0
  left: 0
  right: 0
  bottom: 0
  perspective: $p

@mixin center
  position: absolute
  top: 0
  left: 0
  right: 0
  bottom: 0
  margin: auto      

html, body
  font-size: $side
  background: #222
  overflow: hidden
  width: 100%
  height: 100%
  
.view
  @include view(400)
  pointer-events: none
  user-select: none
    
.plane
  @include plane($side, $side)
    
  &.main
    @include center
    transform: rotateX(60deg) rotateZ(150deg)
    animation: rotate 10s infinite linear    


.cube
  position: absolute
  @include cube($side)
    
  .x, .y
    &::before, &::after
      background: linear-gradient($stops)
      background-size: 1em ($scale + em)
      animation: sides $duration infinite linear
    
  .z
    &::before, &::after
      animation: top $duration infinite linear
    &::before
      animation-delay: -($duration * ($scale - 1 / $scale))
    

@keyframes rotate
  from
    transform: rotateX(60deg) rotateZ(0deg) 
  to
    transform: rotateX(60deg) rotateZ(360deg)         
    
@keyframes top
  @include frames($stops)
        

@keyframes sides
  0%
    background-position: 0 1em
  100%
    background-position: 0 ((1 - $scale) + em)
              
            
!

JS

              
                
              
            
!
999px

Console