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.

HTML Settings

Here you can Sed posuere consectetur est at lobortis. Donec ullamcorper nulla non metus auctor fringilla. Maecenas sed diam eget risus varius blandit sit amet non magna. Donec id elit non mi porta gravida at eget metus. Praesent commodo cursus magna, vel scelerisque nisl consectetur et.

            
              <div class="container">
    <div class="scaler">
      <div class="items node mainNode">
        <div class="blockNode1 node">
          <div class="blockGroup1 node">
            <div class="block1 node bottom">
              <div class="item index1"></div>
              <div class="item index2"></div>
              <div class="item index3"></div>
              <div class="item index4"></div>
              <div class="item index5"></div>
              <div class="item index6"></div>
            </div>
            <div class="block1 node top">
              <div class="item index1"></div>
              <div class="item index2"></div>
              <div class="item index3"></div>
              <div class="item index4"></div>
              <div class="item index5"></div>
              <div class="item index6"></div>
            </div>
          </div>
          <div class="blockNode2 node">
            <div class="block2 node">
              <div class="item index1"></div>
              <div class="item index2"></div>
              <div class="item index3"></div>
              <div class="item index4"></div>
              <div class="item index5"></div>
              <div class="item index6"></div>
            </div>
            <div class="blockNode3 node">
              <div class="block3 node">
                <div class="item index1"></div>
                <div class="item index2"></div>
                <div class="item index3"></div>
                <div class="item index4"></div>
                <div class="item index5"></div>
                <div class="item index6"></div>
              </div>
            </div>
            <!-- /.eyeNode1 node -->
          </div>
          <!-- /.headNode1 node -->
        </div>
        <!-- /.body node -->
      </div>
      <!-- /.items node mainNode -->
    </div>
  </div>
            
          
!
            
              body{
  background: #1D0202;
  width: 100vw;
  height: 100vh;
  margin: 0;
  overflow: hidden;
  font-family: 'Bad Script', cursive;
  font-size: 30px;
}

/** 3D world
 *
 * Here's the 3D world core config
 *
 */

/** 3D box aKa container
 *
 * The 3D box is the limit of the 3D that you'll create in, nothing can get out of it
 *
 */

div.container{
  width: 800px;
  max-width: 100vw;
  height: 400px;
  max-height: 100vh;
  position: absolute;
  top: 50%;
  left: 50%;
  transform: translate(-50%,-50%);
}

div.container::after{
  content: "Dare you hover me?";
  color: #ffffff;
  display: block;
  width: 100%;
  text-align: center;
  position: absolute;
  top: 110%;
  transition: opacity .5s ease 1s;
}

div.container:hover::after{
  transition: opacity 1s ease;
  opacity: 0;
}

/** 3D scaler
 *
 * This is used only to rescale the entire world in order to keep perspective
 *
 */

div.container .scaler{
  position: absolute;
  top: 50%;
  left: 50%;
  perspective: 800px;
  transform: scale(2,2) translate3d(25px,0,0);
  animation: comeIn 1s ease both, opacity 10s infinite cubic-bezier(.6,0,.4,1);
}

/** 3D world main node
 *
 * This main node if the center of everything in you 3D world (pos : 0 0 0) everything you'll going to build in will at least start from this node
 * Animating this node can be usefull to showcase your world
 *
 */

div.container .items{
  transform: rotateX(-40deg) rotateY(49deg);
  animation: rotate 10s infinite cubic-bezier(.6,0,.4,1) alternate-reverse;
}

/** Nodes
 *
 * Nodes are dot used for two thing :
 *
 * > Nodes are the position arround which you can animate blocks linked to, that mean that you have to place the node in terms of the "previous" node (main node = 0 0 0)
 * > Blocks DIRECTLY linked to a specific node must be positionned in terms of this one on the 3D space
 *
 */

div.container .node{
  transform-style: preserve-3d;
  transition: transform 1s ease;
}

/** Blocks
 *
 * Here's the basic block setup which is a basic 100*100*100px cube by default.
 *
 */

div.container .item{
  width: 100px;
  height: 100px;
  position: absolute;
  top: -50px;
  left: -50px;
  background: #292929;
  opacity: 1;
}

/* Creating the cube... */

div.container .item.index1{
  transform: translateZ(50px);
  background: #BF1919;
}
div.container .item.index2{
  transform: rotateY(90deg) translateZ(50px);
  background: #580606;
}
div.container .item.index3{
  transform: rotateY(180deg) translateZ(50px);
  background: #9D2323;
}
div.container .item.index4{
  transform: rotateY(270deg) translateZ(50px);
  background: #820404;
}
div.container .item.index5{
  transform: rotateX(90deg) translateZ(50px);
  background: #B10B0B;
}
div.container .item.index6{
  transform: rotateX(270deg) translateZ(50px);
  background: #7E1919;
}

/** Construction
 *
 * Construction of your 3D world start here, the idea is to have 3 elements par block : a node, a block, an item :
 *
 * Node must be the first thing you need to place in the world using translate3d and rotate3d if needed, animation of the block (and its attached block) will be made through the node
 * Once your node is placed you'll need to scale THEN place the block attached to it using scale3d, translate3d and rotate3d if needed
 * Finally you can skin the block using the .item link, if you want to skin faces differently you can used their index (.indexX) : 
 * (1 = face 2 = left side 3 = backface 4 = right side 5 = top 6 = bottom)
 *
 */

/* First block */

div.container .blockNode1{
}

div.container .block1.bottom{
  transform: scale3d(.2,0.7,.2) translateY(28.5px);
}

div.container .block1.top{
  transform: scale3d(.2,.3,.2) rotateY(-90deg) skewY(-38.8deg) translateY(-48.1px);
}

div.container .block1.top .item.index1{background: #820404;}
div.container .block1.top .item.index2{background: #BF1919;}
div.container .block1.top .item.index3{background: #580606;}
div.container .block1.top .item.index4{background: #9D2323;}

/* Second block */

div.container .blockNode2{
  transform: translate3d(0,45px,-10px);
}

div.container .block2{
  transform: translate3d(0,0,-40px) scale3d(.2,.2,.8);
}

/* Third block */

div.container .blockNode3{
  transform: translate3d(10px,0,-70px);
}

div.container .block3{
  transform: translate3d(48.2px,0,0) scale3d(.964,.2,.2);
}

 /* Block animation */

div.container:hover .blockNode1{
  transform: translate3d(0,0,50px);
}

div.container:hover .blockGroup1{
  animation: floating1 6s ease-in-out infinite;
}

div.container:hover .blockNode2{
  transform: translate3d(-100px,45px,-10px);
}

div.container:hover .block2{
  animation: floating2 6s ease-in-out infinite;
}

div.container:hover .blockNode3{
  transform: translate3d(10px,-100px,-70px);
}

div.container:hover .block3{
  animation: floating3 6s ease-in-out infinite;
}

/** Animation
 *
 * Here are all the animation of the 3D world
 */

 @keyframes comeIn{
  0%  {transform: scale(2,2) translate3d(25px,-500px,0); opacity: 0;}
  40% {opacity: 0;}
}

@keyframes rotate{
  0%   {transform: rotateX(-40deg) rotateY(49deg);}
  15%  {transform: rotateX(-40deg) rotateY(49deg);}
  85%  {transform: rotateX(320deg) rotateY(769deg);}
  100% {transform: rotateX(320deg) rotateY(769deg);}
}

@keyframes floating1{
  25%  {transform: rotate3D(1,1,1,6deg) translate3d(0,0,50px);}
  75%  {transform: rotate3D(1,1,1,-6deg) translate3d(0,0,50px);}
}

@keyframes floating2{
  25%  {transform: rotate3D(1,1,1,-9deg) translate3d(0,0,-40px) scale3d(.2,.2,.8);}
  75%  {transform: rotate3D(1,1,1,9deg) translate3d(0,0,-40px) scale3d(.2,.2,.8);}
}

@keyframes floating3{
  25%  {transform: rotate3D(1,1,1,12deg) translate3d(48.2px,0,0) scale3d(.964,.2,.2);}
  75%  {transform: rotate3D(1,1,1,-12deg) translate3d(48.2px,0,0) scale3d(.964,.2,.2);}
}
            
          
!
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.

Console