Pen Settings

HTML

CSS

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

JavaScript

Babel is required to process package imports. If you need a different preprocessor remove all packages first.

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

Behavior

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.

Format on Save

If enabled, your code will be formatted when you actively save your Pen. Note: your code becomes un-folded during formatting.

Editor Settings

Code Indentation

Want to change your Syntax Highlighting theme, Fonts and more?

Visit your global Editor Settings.

HTML

              
                .wrap
 .grid.slide
  -64.times do
   .cell
              
            
!

CSS

              
                $t: rgba(255,255,255,0.0001);

body{
  display:flex;
  width:100vw;
  height:100vh;
  justify-content:center;
  align-items:center;
  overflow:hidden;
  --height: 20px;
  --color1: #fff;
  --color2:#fff;
  --delay:0s;
  perspective:2000px;
  *{
    transform-style:preserve-3d;
    &:before, &:after{
      transform-style:preserve-3d;
    }
  }
  .wrap{
    width:600px;
    min-width:600px;
    height:600px;
    position:relative;
    transform:translateY(75px) translateX(-25px) rotateX(75deg);
    backface-visibility:hidden;
    .grid{
      position:absolute;
      width:100%;
      height:100%;
      left:0;
      top:0;
      transform-style:preserve-3d;
      backface-visibility:hidden;
      display:grid;
      grid-template-columns:repeat(8, 10%);
      grid-template-rows:repeat(8, 10%);
      transform:rotate(-135deg);
      box-shadow:0 0 0 100vw #fff, inset 0 0 0 100vw #fff;
      &:before{
        content:'';
        position:absolute;
        width:100vw;
        height:50vw;
        background:#fff;
        top:100%;
        right:0;
        transform-origin:top;
        transform:rotateX(90.005deg);
        display:none;
      }
      &.slide{
        .cell{
          transform:translateZ(0) !important;
          transition-delay:0s;
          background:#fff;
          box-shadow:inset 0 0 0 1px #fff;
        }
      }
      .cell{
        box-shadow:inherit;
        transform:scale(0.75) translateY(calc(-100% - var(--shift))) translateX(calc(-100% + var(--shift))) translateZ(var(--height));
        background:#f1f1f1;
        box-shadow:inset 0 0 0 1px rgba(0,0,0,0.15);
        transition:0.6s ease-in-out;
        backface-visibility:hidden;
        grid-row-end:span var(--size);
        grid-column-end:span var(--size);
        will-change:transform;
        min-height:75px;
        @for $i from 1 through 64{
          &:nth-of-type(#{$i}){
            transition-delay:#{$i/60}s;
          }
        }
        &.class11{
          transform:scale(0.75) translateY(calc(-100% - var(--shift))) translateX(calc(-100% + var(--shift))) translateZ(calc(var(--height) * 2));
          &:before{
            height:calc(var(--height) * 2);
          }
          &:after{
            width:calc(var(--height) * 2);
            left:calc(var(--height) * -2);
          }
        }
        &.class1, &.class4, &.class8{
          &:before{
            box-shadow:inset 0 0 0 1px rgba(0,0,0,0.15), inset 0 0 0 15px #efefef;
            background:repeating-linear-gradient(to bottom, #efefef, #efefef 5px, $t 5px, $t 15px, #efefef 15px, #efefef 20px), repeating-linear-gradient(to right, #efefef, #efefef 5px, $t 5px, $t 15px, #efefef 15px, #efefef 20px), #ccc;
            background-position:50% 10px;
          }
          &:after{
            box-shadow:inset 0 0 0 1px rgba(0,0,0,0.15), inset 0 0 0 15px #fff;
            background:repeating-linear-gradient(to bottom, #fff, #fff 5px, $t 5px, $t 15px, #fff 15px, #fff 20px), repeating-linear-gradient(to left, #fff, #fff 5px, $t 5px, $t 15px, #fff 15px, #fff 20px), #cecece;
            background-position:20px 50%;
          }
        }
        &.class2, &.class5, &.class7{
          &:before{
            box-shadow:inset 0 0 0 1px rgba(0,0,0,0.15), inset 0 0 0 15px #efefef;
            background:repeating-linear-gradient(to bottom, #efefef, #efefef 2px, $t 2px, $t 4px, #efefef 4px, #efefef 6px), #ccc;
          }
          &:after{
            box-shadow:inset 0 0 0 1px rgba(0,0,0,0.15), inset 0 0 0 15px #fff;
            background:repeating-linear-gradient(to right, #fff, #fff 2px, $t 2px, $t 4px, #fff 4px, #fff 6px), #cecece;
          }
        }
        &.class9, &.class6{
          &:before{
            box-shadow:inset 0 0 0 1px rgba(0,0,0,0.15), inset 0 0 0 15px #efefef;
            background:repeating-linear-gradient(to right, #efefef, #efefef 2px, $t 2px, $t 8px, #efefef 8px, #efefef 10px), #ccc;
          }
          &:after{
            box-shadow:inset 0 0 0 1px rgba(0,0,0,0.15), inset 0 0 0 15px #fff;
            background:repeating-linear-gradient(to bottom, #fff, #fff 2px, $t 2px, $t 8px, #fff 8px, #fff 10px), #cecece;
          }
        }
        &.class10{
          &:after{
            box-shadow:inset 0 0 0 1px rgba(0,0,0,0.15);
            background:radial-gradient(circle at left, #ccc, #ccc 10px, $t 10px), linear-gradient(to bottom, #fff calc(50% - 10px), #ccc calc(50% - 10px), #ccc calc(50% + 10px), #fff calc(50% + 10px)), #fff;
            background-position:15px 50%, 0% 0%, 50%;
            background-size:100% 100%, 15px 100%, 100%;
            background-repeat:no-repeat;
          }
        }
        &.class3{
          &:before{
            box-shadow:inset 0 0 0 1px rgba(0,0,0,0.15), inset 0 0 0 15px #efefef;
            background:repeating-linear-gradient(to bottom, #efefef, #efefef 5px, $t 5px, $t 20px, #efefef 20px, #efefef 30px), repeating-linear-gradient(to right, #efefef, #efefef 5px, $t 5px, $t 15px, #efefef 15px, #efefef 20px), #ccc;
            background-position:50% 10px;
          }
          &:after{
            box-shadow:inset 0 0 0 1px rgba(0,0,0,0.15), inset 0 0 0 15px #fff;
            background:repeating-linear-gradient(to bottom, #fff, #fff 5px, $t 5px, $t 15px, #fff 15px, #fff 20px), repeating-linear-gradient(to left, #fff, #fff 5px, $t 5px, $t 15px, #fff 15px, #fff 20px), #cecece;
            background-position:20px 50%;
          }
        }
        &:before{
          content:'';
          position:absolute;
          bottom:100%;
          left:0;
          width:100%;
          height:var(--height);
          background:#efefef;
          box-shadow:inherit;
          transform-origin:bottom;
          transform:rotateX(90deg);
          backface-visibility:hidden;
        }
        &:after{
          content:'';
          position:absolute;
          bottom:00%;
          left:calc(var(--height) * -1);
          height:100%;
          width:var(--height);
          background:#fff;
          box-shadow:inherit;
          transform-origin:right;
          transform:rotateY(-90deg);
          backface-visibility:hidden;
        }
      }
    }
  }
}
              
            
!

JS

              
                

function draw() {
    var cellClass =  Array.from({length: 20}, (x,i) => "class" + i);
    $(".wrap .grid").addClass("slide");
  setTimeout(function(){
    $(".grid .cell").removeClass(cellClass);
    $(".wrap .grid").removeClass("slide");
    $(".grid .cell").each(function() {
      $(this).addClass("class" + Math.floor(Math.random() * 11 + 1));
    });
    $(".grid .cell").each(function() {

      
      $(this)
        .get(0)
        .style.setProperty("--size", Math.floor(Math.random() * 2 + 1));


      $(this)
        .get(0)
        .style.setProperty("--height", (Math.floor(Math.random() * 50) * 5) + "px");
         
      $(this)
        .get(0)
        .style.setProperty("--angle", (Math.floor(Math.random() * 4) * 90) + "deg");
      
      $(this)
        .get(0)
        .style.setProperty("--shift", ((Math.floor(Math.random() * 150) - 50) * 2.5) + "px");
      
    });
  }, 1600);
 
}

$(function() {
  draw();
  $("body").on("click", function() {
    draw();
  });
});

setInterval(draw,6000);

              
            
!
999px

Console