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.

+ add another resource

You're using npm packages, so we've auto-selected Babel for you here, which we require to process imports and make it all work. If you need to use a different JavaScript preprocessor, remove the packages in the npm tab.

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

Use npm Packages

We can make npm packages available for you to use in your JavaScript. We use webpack to prepare them and make them available to import. We'll also process your JavaScript with Babel.

⚠️ This feature can only be used by logged in users.

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
🕑 One or more of the npm packages you are using needs to be built. You're the first person to ever need it! We're building it right now and your preview will start updating again when it's ready.
Loading ..................