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

  - (1..64).each do |i|
      - (1..6).each do |j|
              @import compass

$m: 8
$side: 2em
$factor: 20
$faces: 6

  height: 100%
  perspective: $factor*$side
  background: black

  position: absolute
  top: 50%
  left: 50%
  margin: -$m*$side/2
  padding: 0
  width: $m*$side
  transform-style: preserve-3d
  transform: rotateX(60deg) rotateZ(45deg)
  list-style: none

  float: left
  position: relative
  width: $side
  height: $side
  transform-style: preserve-3d
  transition: transform 1.5s ease-in
  cursor: pointer
    transform: translateZ(.95*$side)
    transition: transform .5s ease-out
    position: absolute
    width: inherit
    height: inherit
    box-shadow: 0 0 0 1px black
    @for $k from 1 to 7
        @if $k < 5
          transform: rotateY(#{($k - 1)*90}deg)  translateZ($side/2)
          transform: rotateX(#{($k - 5)*180 - 90}deg) translateZ($side/2)
  @for $i from 1 to 9
    @for $j from 1 to 9
      &:nth-child(#{($i - 1)*$m + $m - $j + 1}) .face
        background: rgb(0, ($i + $j - 2)*255/(2*$m), 255 - ($i + $j - 2)*255/$m/2)
No JS here, just a comment. Simply hover the cubes. :)

Works in browsers that support 3D transforms and nesting 3D transformed elements - see http://caniuse.com/#feat=transforms3d
Loading ..................