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.

            
              mixin cube
  div.cube
    div.left
    div.center
    div.right
    div.bottom
    div.shadow

doctype html
html
  head
    title "Loading bars"
body
div#vignette
div#container
  div#pos
    - for (var x = 0; x < 8; x++)
      +cube()
            
          
!
            
              @import "compass/css3";

$number-of-cubes: 8;
$cubes-margin: 8px;

$bar-height: 150px;
$bar-width: 30px;
$bar-depth: 100px;

$rotX: 3deg;
$rotY: 0deg;
$rotZ: 0deg;
$transX: 0;
$transY: 0;

$animSpeed: 1s;

$perspective: 2200px;

@for $i from 1 through $number-of-cubes {
  .cube:nth-child(#{$i}),
  .cube:nth-child(#{$i}) div
    {
      z-index: $i;
      animation-delay: $i*($animSpeed/12);
    }
}

html{
 height: 100%; 
}

body{
    background-color: #323036;
    position: relative;
    width: 100%;
    height: 100%;
    padding: 0;
    margin: 0;
    display: table;
}

#vignette{
    display: block;
    position: absolute;
    left: 0;
    right: 0;
    top: 0;
    bottom: 0;
    z-index: 4;
  
    background-image: -webkit-radial-gradient(50% 50%, ellipse cover, rgba(0,0,0,0), rgba(0,0,0,0.5));  
    background-image: -moz-radial-gradient(50% 50%, ellipse cover, rgba(0,0,0,0), rgba(0,0,0,0.5)); 
}



#pos{
  width: ($bar-width + $cubes-margin) * $number-of-cubes;
  margin: 0 auto;
}

#container{
  width: 100%;
  perspective: $perspective;
  padding: 20px 60px;
  position: relative;
  display: table-cell;
  vertical-align: middle;
}

.cube{
  width: $bar-width;
  height: $bar-height;
  position: relative;
  margin-right: $cubes-margin;
  float: left;
  transform-style: preserve-3d;
  box-shadow: 0 0 5px rgba(0,0,0, .2);
  animation: animCube; /* Safari and Chrome */
  animation-iteration-count: infinite;
}

.cube div{
  position: absolute;
  display: block;
  width: $bar-width;
  height: $bar-height;
}

.cube .center{
  width: $bar-width;
  box-shadow: 0 0 3px rgba(0,0,0,.3), inset 0 1px rgba(255,255,255,.05);
  animation: animCenter;
  animation-iteration-count: infinite;
}

.cube .bottom{
  width: $bar-width;
  height: 10px;
  bottom: 0;
  transform: rotateX(90deg);
  transform-origin: center bottom;
  animation: animBottom;
  animation-iteration-count: infinite;
}

.cube .left{
  left: 0;
  transform: rotateY(90deg);
  transform-origin: left center;
  animation: animSide;
  animation-iteration-count: infinite;
}

.cube .right{
  right: 0;
  transform: rotateY(-90deg);
  transform-origin: right center;
  animation: animSide;
  animation-iteration-count: infinite;
}

.cube .left,
.cube .center,
.cube .right,
.cube .bottom,
.cube{
  animation-duration: $animSpeed;
  animation-timing-function: ease-in-out;
}

.left,
.right{
  background-color: #2b2830;
  background-image: linear-gradient(top, rgba(255,255,255,0.1), rgba(255,255,255,0));
}


.center{
    background-color: #2b2830;
    background-image: linear-gradient(top, rgba(255,255,255,0.15), rgba(255,255,255,0)); 
}

.bottom{
    background-color: #1f1d23;
    background-image: linear-gradient(bottom, rgba(255,255,255,0.1), rgba(255,255,255,0)); 
}

@keyframes animCube
{
    30%  {  transform: translateZ($bar_height) translatex($transX) translateY($transY) rotatex($rotX) rotatey($rotY) rotateZ($rotZ);
	          box-shadow: 0 0 20px rgba(0,0,0,.5), 0 12px 20px 1px rgba(0,0,0,.5);
	 }

    100%  {  
	          transform: translateZ(0px) rotatez(0deg);
	          box-shadow: 0 0 30px rgba(0,0,0,.5), 0 0 0 0 rgba(0,0,0,0);
    }
}

@keyframes animSide
{
    30%  {  width: $bar-depth;
            background-color: #1d1c1f;      
    }
    95%  {  width: 10px; }
}

@keyframes animBottom
{
    30%  {  height: $bar-depth; }
    95%  {  height: 10px; }
}



@keyframes animCenter /* Safari and Chrome */
{
    20%  {  background-color: #6a6371;
	    box-shadow: 0 0 3px rgba(255,255,255,0.15), inset 0 1px rgba(255,255,255,.5);
	 }
    65%  {  
	    box-shadow: 0 0 3px rgba(255,255,255,0), inset 0 1px rgba(255,255,255,.25);
}
}

            
          
!
999px
Loading ..................

Console