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.

            
              <div id="tridiv">
  <div class="scene">
    <div class="shape cuboid-1 cub-1">     
      <div class="face bk"><div></div></div>
      <div class="face rt"><div></div></div>
      <div class="face bm"><div></div></div>
    </div>
    <div class="shape cuboid-2 cub-2">
      <div class="face bk"><div></div></div>
      <div class="face rt"><div></div></div>
      <div class="face bm"><div></div></div>
    </div>
  </div>
</div>
            
          
!
            
              #tridiv {
  perspective: 5000px;
  position: absolute;
  overflow: hidden;
  width: 100%;
  height: 100%;
  background: transparent;
  font-size: 100%;
}

.scene,
.shape,
.face{
  position: absolute;
  transform-style: preserve-3d;
}

.scene {
  width: 0;
  height: 0;
  top: 50%;
  left: 50%;
  transform:rotateX(-392deg) rotateY(677deg);
}

.shape {
  top: 50%;
  left: 50%;
  width: 0;
  height: 0;
  transform-origin: 50%;
}

.face {
  overflow: hidden;
  transform-origin: 0 0;
}

.face {
  background-size: 100% 100%!important;
  background-position: center;
}

[class*="cuboid"] .ft,
[class*="cuboid"] .bk {
  width: 100%;
  height: 100%;
}

[class*="cuboid"] .bk {
  left: 100%;
}

[class*="cuboid"] .rt {
  transform: rotateY(-90deg) translateX(-50%);
}

[class*="cuboid"] .lt {
  transform: rotateY(90deg) translateX(-50%);
}

[class*="cuboid"] .tp {
  transform: rotateX(90deg) translateY(-50%);
}

[class*="cuboid"] .bm {
  transform: rotateX(-90deg) translateY(-50%);
}

[class*="cuboid"] .lt {
  left: 100%;
}

[class*="cuboid"] .bm {
  top: 100%;
}

.cub-1 {
  transform: translate3D(0em, 0em, 0em) rotateX(0deg) rotateY(0deg) rotateZ(0deg);
  opacity: 1;
  width: 20em;
  height: 20em;
  margin: -10em 0 0 -10em;
}

.cub-1 .ft {
  transform: translateZ(10em);
}

.cub-1 .bk {
  transform: translateZ(-10em) rotateY(180deg);
}

.cub-1 .rt,
.cub-1 .lt {
  width: 20em;
  height: 20em;
}

.cub-1 .tp,
.cub-1 .bm {
  width: 20em;
  height: 20em;
}

.cub-1 .face {
  background-color: #FFFFFF;
}
.cub-1 .face div{
  position:absolute;
  top:0.1em;
  left:0.1em;
  right:0.1em;
  bottom:0.1em;
}

.cub-1 .bk div{
  background: repeating-linear-gradient( 90deg, #ff4143 0px, #ff4143 23px, #ffffff 23px, #ffffff 46px);
}

.cub-1 .bm div{
  background: repeating-linear-gradient( 0deg, #ffffff 0px, #ffffff 23px, #2b3e51 23px, #2b3e51 46px);
}

.cub-1 .rt div{
  background: repeating-linear-gradient( 0deg, #ffffff 0px, #ffffff 23px, #6abbdc 23px, #6abbdc 46px);
}
/* .cub-2 styles */

.cub-2 {
  transform: translate3D(0, 0, -4.9em) rotateX(0deg) rotateY(0deg) rotateZ(0deg);
  opacity: 1;
  width: 9.8em;
  height: 9.8em;
  margin: -0.1em 0 0 -9.9em;
}

.cub-2 .ft {
  transform: translateZ(4.9em);
}

.cub-2 .bk {
  transform: translateZ(-4.9em) rotateY(180deg);
}

.cub-2 .rt,
.cub-2 .lt {
  width: 9.8em;
  height: 9.8em;
}

.cub-2 .tp,
.cub-2 .bm {
  width: 9.8em;
  height: 9.8em;
}

.cub-2 .face  {
  background: white;
}
.cub-2 .face div {
  position:absolute;
  top:1em;
  left:1em;
  right:1em;
  bottom:1em;
}

.cub-2 .bk div {
  background: #6abbdc;
}

.cub-2 .bm div { 
  background: #ff4143;
}

.cub-2 .rt div{  
   background: #2b3e51;
}
            
          
!
            
              var w = $(window).width(),
  h = $(window).height(),
  console = $('#console');

function handleMouseMove(e) {
  var Xperc = e.clientX / w,
    Yperc = e.clientY / h,
    Xpos = Math.floor(Xperc * 100),
    Ypos = Math.floor(Yperc * 100),
    Xrev = 100 - Xpos,
    Yrev = 100 - Ypos;
  
  $('#tridiv').css({
    perspectiveOrigin: Xrev + '% ' + Yrev + '%'
  });
}

$(document).on('mousemove touchmove',handleMouseMove);
            
          
!
999px
Loading ..................

Console