Pen Settings

HTML

CSS

CSS Base

Vendor Prefixing

Add External Stylesheets/Pens

Any URLs 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 its URL and the proper URL extension.

+ 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

Auto Save

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

              
                - var line_cube_n = 13
- var cube_n = Math.pow(line_cube_n, 2)

mixin cube()
  .cube
    - for (var i=0; i<3; i++)
      .cube__f

.scene
  .plane
    - for (var j=0; j < Math.sqrt(cube_n); j++)
      .line
        - for (var i=0; i < Math.sqrt(cube_n); i++)
          +cube
          
              
            
!

CSS

              
                @import 'compass'

$line-cube-n: 13
$cube-n: pow($line-cube-n, 2)
$cube-s: .4em
$cube-n-root: sqrt($cube-n)
$bg-color: #1F1A31
$p-color: blue
$s-color: red

=center
  position: absolute
  top: 50%
  left: 50%

html, body
  height: 100%
  width: 100%
  
body
  background: $bg-color
  display: flex
  align-items: center
  justify-content: center
  
div
  transform-style: preserve-3d
  perspective: 20000px
  
  
.plane
  font-size: 60px
  position: relative
  transform: rotateX(60deg) rotateZ(45deg)
  
  .line
    position: absolute
    height: $cube-s
    width: $cube-s * $cube-n-root
    @for $i from 0 to $cube-n-root
      &:nth-child(#{$i + 1})
        top: $cube-s * $i
        animation: anim 1s ease-in-out infinite $i * .1s
        .cube
          @for $k from 0 to $cube-n-root
            &:nth-child(#{$k + 1})
              $bg : mix($s-color, $p-color, random() * 70 * 1%)
              background: $bg
              animation: anim 1s ease-in-out infinite $k * .1s
              .cube__f
                @for $m from 0 to 3
                  &:nth-child(#{$m + 1})
                    @if $m < 1
                      background: lighten($bg, 20%)
                    @else if $m == 1
                      background: darken($bg, 10%)

    .cube
      height: $cube-s
      width: $cube-s
      position: absolute
      transition: transform .1s ease-in-out
      backface-visibility: hidden
      
      @at-root
        @keyframes anim
          0%, 100%
            transform: translateZ(0)
          50%
            transform: translateZ($cube-s/2)
      
      @for $j from 0 to $cube-n-root
        &:nth-child(#{$j + 1})
          left: $cube-s * $j
      
      &__f
        +center
        margin-top: -$cube-s/2
        margin-left: -$cube-s/2
        height: $cube-s
        width: $cube-s
        background: inherit
        
        @for $l from 0 to 3
          &:nth-child(#{$l + 1})
            transform: if($l < 2,rotateY(90 * $l * 1deg), rotateX(pow(-1, $l) * -90 * 1deg)) translateZ($cube-s / 2)



              
            
!

JS

              
                
              
            
!
999px

Console