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.

            
              <h1>viewport as perspective</h1>

  <div class="cube">
    <div class="side front"></div>
    <div class="side back"></div>
    <div class="side right"></div>
    <div class="side left"></div>
    <div class="side top"></div>
    <div class="side bottom"></div>
  </div>


<h2>Please scroll slowly!</h2>
  <div class="cube">
    <div class="side front"></div>
    <div class="side back"></div>
    <div class="side right"></div>
    <div class="side left"></div>
    <div class="side top"></div>
    <div class="side bottom"></div>
  </div>
  <div class="cube">
    <div class="side front"></div>
    <div class="side back"></div>
    <div class="side right"></div>
    <div class="side left"></div>
    <div class="side top"></div>
    <div class="side bottom"></div>
  </div>

  <div class="cube">
    <div class="side front"></div>
    <div class="side back"></div>
    <div class="side right"></div>
    <div class="side left"></div>
    <div class="side top"></div>
    <div class="side bottom"></div>
  </div>

  <div class="cube">
    <div class="side front"></div>
    <div class="side back"></div>
    <div class="side right"></div>
    <div class="side left"></div>
    <div class="side top"></div>
    <div class="side bottom"></div>
  </div>

  <div class="cube">
    <div class="side front"></div>
    <div class="side back"></div>
    <div class="side right"></div>
    <div class="side left"></div>
    <div class="side top"></div>
    <div class="side bottom"></div>
  </div>

  <div class="cube">
    <div class="side front"></div>
    <div class="side back"></div>
    <div class="side right"></div>
    <div class="side left"></div>
    <div class="side top"></div>
    <div class="side bottom"></div>
  </div>

  <div class="cube">
    <div class="side front"></div>
    <div class="side back"></div>
    <div class="side right"></div>
    <div class="side left"></div>
    <div class="side top"></div>
    <div class="side bottom"></div>
  </div>

  <div class="cube">
    <div class="side front"></div>
    <div class="side back"></div>
    <div class="side right"></div>
    <div class="side left"></div>
    <div class="side top"></div>
    <div class="side bottom"></div>
  </div>
  
  <div class="cube">
    <div class="side front"></div>
    <div class="side back"></div>
    <div class="side right"></div>
    <div class="side left"></div>
    <div class="side top"></div>
    <div class="side bottom"></div>
  </div>

  <div class="cube">
    <div class="side front"></div>
    <div class="side back"></div>
    <div class="side right"></div>
    <div class="side left"></div>
    <div class="side top"></div>
    <div class="side bottom"></div>
  </div>
  <div class="cube">
    <div class="side front"></div>
    <div class="side back"></div>
    <div class="side right"></div>
    <div class="side left"></div>
    <div class="side top"></div>
    <div class="side bottom"></div>
  </div>
  <h3>Oh yeah, that was great!</h3>
  <div class="cube">
    <div class="side front"></div>
    <div class="side back"></div>
    <div class="side right"></div>
    <div class="side left"></div>
    <div class="side top"></div>
    <div class="side bottom"></div>
  </div>
            
          
!
            
              @bg:#468;
* {margin:0;padding:0;}
html, body {
  width: 100%;
  height: 100%;
  padding: 0;
  margin: 0;
  overflow: hidden;
  
}
h1,h2,h3,h4,h5,h6 {
  margin:1em 0;
}


body {
  text-align:center;
  background:@bg;
  font-size: 20px;
  overflow: auto;
  text-align:center;
  color:white;
  font-family:sans-serif;
  
  perspective: 500px;
}
.cube {
  display:inline-block;
  margin:50px auto;
  width: 100%;
  height: 100px;
  
  transform-style:preserve-3d;
  position: relative;
}
.cube .side {
  width: 100px;
  height: 100px;
  display: block;
  position: absolute;
  border: 1px solid #eee;
  left:50%;
  margin-left:-50px;
  background:fade(#fff,25%);
  transform-style:preserve-3d;
  //backface-visibility: hidden;
}

@speed:10s;

.cube .front  {animation:@speed spin-front linear infinite; transform:rotateY(0deg ) translateZ(50px)}
.cube .back   {animation:@speed spin-back linear infinite; transform: rotateX( 180deg )translateZ(50px); }
.cube .right  { animation:@speed spin-right linear infinite; transform: rotateY(  90deg )translateZ(50px); }
.cube .left   { animation:@speed spin-left linear infinite; transform: rotateY( -90deg )translateZ(50px); }
.cube .top    { animation:@speed spin-top linear infinite; transform: rotateX(  90deg )translateZ(50px); }
.cube .bottom { animation:@speed spin-bottom linear infinite; transform: rotateX( -90deg )translateZ(50px); }


.cube.stop > div {
  animation-play-state:paused;  
}


@keyframes spin-front {
    from {transform:rotateY(0deg) translateZ(50px);}
  to {transform:rotateY(360deg) translateZ(50px);}
}


@keyframes spin-back {
    from {transform:rotateX(180deg ) rotateY(0deg) translateZ(50px)}
  to {transform:rotateX(180deg) rotateY(-360deg) translateZ(50px)}
}

@keyframes spin-left {
    from {transform:rotateY(-90deg ) translateZ(50px)}
  to {transform:rotateY(270deg)translateZ(50px)}
}
@keyframes spin-top {
    from {transform:rotateY(0deg)rotateX(  90deg)translateZ(50px)}
  to {transform:rotateY(360deg)rotateX(90deg )translateZ(50px)}
}
@keyframes spin-right {
    from {transform:rotateY(  90deg )translateZ(50px)}
  to {transform:rotateY(450deg )translateZ(50px)}
}
@keyframes spin-bottom {
    from {transform:rotateY(0deg)rotateX( -90deg )translateZ(50px)}
  to {transform:rotateY(360deg)rotateX( -90deg )translateZ(50px)}
}

            
          
!
            
              $().ready(function()  {
   $(".cube").click(function() {
      $(this).toggleClass("stop");
   });
});
            
          
!
999px
🕑 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 ..................

Console