Pen Settings

HTML

CSS

CSS Base

Vendor Prefixing

Add External Stylesheets/Pens

Any URLs added here will be added as <link>s in order, and before the CSS in the editor. You can use the CSS from another Pen by using its URL and the proper URL extension.

+ add another resource

JavaScript

Babel includes JSX processing.

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

Packages

Add Packages

Search for and use JavaScript packages from npm here. By selecting a package, an import statement will be added to the top of the JavaScript editor for this package.

Behavior

Auto Save

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

              
                <link href="https://fonts.googleapis.com/css?family=Bungee&display=swap" rel="stylesheet">

<div id="wrapper">
  <div id="flick">
    <div id="cabinet">
      <svg class="cabinet-side">
        <rect class="front" x="0" y="0" width="240" height="40" />
        <rect class="front" x="0" y="40" width="30" height="120" />
        <rect class="front" x="210" y="40" width="30" height="120" />
        <rect class="front" x="0" y="160" width="240" height="40" />
        <rect class="front" x="0" y="200" width="30" height="120" />
        <rect class="front" x="210" y="200" width="30" height="120" />
        <rect class="front" x="0" y="320" width="240" height="40" />
        <rect class="front" x="0" y="360" width="30" height="120" />
        <rect class="front" x="210" y="360" width="30" height="120" />
        <rect class="front" x="0" y="480" width="240" height="120" />
      </svg>
      <div class="cabinet-key"></div>
      <div class="cabinet-side back"></div>
      <div class="cabinet-side up"></div>
      <div class="cabinet-side down"></div>
      <div class="cabinet-side left"></div>
      <div class="cabinet-side right"></div>
      <div class="cabinet-shadow"></div>
      <div class="d-1 drawer body">
        <span class="sign hidden">
          My Directory
        </span>
        <div class="grip"></div>
        <div class="body-side"></div>
        <div class="body-top"></div>
        <div class="drawer-side left">
          <div class="side-top left"></div>
        </div>
        <div class="file-wrapper" style="transform: translateZ(-60px)">
          <div class="cover red"></div>
          <div class="paper-top"></div>
          <div class="paper-side"></div>
          <svg class="red"><polygon points="10 20 110 20 120 0 170 0 170 100 10 100" /><rect fill="white" x="130" y="10" width="30" height="5" /></svg>
        </div>
        <div class="file-wrapper" style="transform: translateZ(-100px)">
          <div class="cover yellow"></div>
          <div class="paper-top"></div>
          <div class="paper-side"></div>
          <svg class="yellow"><polygon points="10 20 110 20 120 0 170 0 170 100 10 100" /><rect fill="white" x="130" y="10" width="30" height="5" /></svg>
        </div>
        <div class="file-wrapper" style="transform: translateZ(-120px)">
          <div class="cover blue"></div>
          <div class="paper-top"></div>
          <div class="paper-side"></div>
          <svg class="blue"><polygon points="10 20 110 20 120 0 170 0 170 100 10 100" /><rect fill="white" x="130" y="10" width="30" height="5" /></svg>
        </div>
        <div class="file-wrapper" style="transform: translateZ(-160px)">
          <div class="cover red"></div>
          <div class="paper-top"></div>
          <div class="paper-side"></div>
          <svg class="red"><polygon points="10 20 110 20 120 0 170 0 170 100 10 100" /><rect fill="white" x="130" y="10" width="30" height="5" /></svg>
        </div>
        <div class="file-wrapper" style="transform: translateZ(-180px)">
          <div class="cover yellow"></div>
          <div class="paper-top"></div>
          <div class="paper-side"></div>
          <svg class="yellow"><polygon points="10 20 110 20 120 0 170 0 170 100 10 100" /><rect fill="white" x="130" y="10" width="30" height="5" /></svg>
        </div>
        <div class="file-wrapper" style="transform: translateZ(-220px)">
          <div class="cover blue"></div>
          <div class="paper-top"></div>
          <div class="paper-side"></div>
          <svg class="blue"><polygon points="10 20 110 20 120 0 170 0 170 100 10 100" /><rect fill="white" x="130" y="10" width="30" height="5" /></svg>
        </div>
        <div class="file-wrapper" style="transform: translateZ(-240px)">
          <div class="cover yellow"></div>
          <div class="paper-top"></div>
          <div class="paper-side"></div>
          <svg class="yellow"><polygon points="10 20 110 20 120 0 170 0 170 100 10 100" /><rect fill="white" x="130" y="10" width="30" height="5" /></svg>
        </div>
        <div class="drawer-side right">
          <div class="side-top"></div>
        </div>
        <div class="drawer-bottom"></div>
      </div>
      <div class="d-2 drawer body">
        <div class="grip"></div>
        <div class="body-side short"></div>
        <div class="body-top short"></div>
      </div>
      <div class="d-3 drawer body">
        <div class="grip"></div>
        <div class="body-side short"></div>
        <div class="body-top short"></div>
      </div>
    </div>
  </div>
</div>

<div class="github-link">
  <a class="link" href="https://github.com/naver/egjs-flicking" target="_blank">
  Made with @egjs/Flicking
    <img height="32" width="32" src="https://cdn.jsdelivr.net/npm/simple-icons@latest/icons/github.svg" />
  </a>
</div>
              
            
!

CSS

              
                * {
  backface-visibility: hidden;
}
body {
  overflow: hidden;
}

.eg-flick-viewport,
.eg-flick-camera {
  transform-style: preserve-3d;
}

#wrapper {
  width: 100%;
  min-height: 100vh;
  padding: 20px;
  box-sizing: border-box;
  white-space: nowrap;
  transform-style: preserve-3d;
  transform: matrix3d(1, -0.5736, -0.8192, 0, 0, 1.1585, -0.8112, 0, 1, 0.5736, 0.8192, 0, 0, 0, 0, 1);
}

#flick {
  min-height: 100vh;
  transform-style: preserve-3d;
}

#cabinet {
  display: inline-block;
  width: 240px;
  height: 600px;
  transition: transform 500ms;
  transform: rotateZ(0deg);
  will-change: transform;
  transform-origin: 100% 100%;
  transform-style: preserve-3d;
}

#cabinet.move {
  transition: transform 300ms;
  transform-origin: 100% 100%;
  transform: rotateZ(3deg);
}

#cabinet.stop {
  animation-name: swing;
  animation-duration: 300ms;
  animation-timing-function: ease-in;
  animation-delay: 0s;
  animation-iteration-count: 1;
  animation-direction: normal;
  animation-fill-mode: both;
  animation-play-state: running;
}
.cabinet-key {
  position: absolute;
  top: 5px;
  right: 5px;
  width: 20px;
  height: 20px;
  border-radius: 20px;
  background: beige;
}
.cabinet-side {
  width: 100%;
  height: 100%;
  position: absolute;
  left: 0; top: 0;
}
.front {
  fill: #2ac176;
}
.cabinet-side.up {
  width: 240px;
  height: 280px;
  background: #54ff9e;
  transform-origin: top;
  transform: translateZ(-280px) rotateX(90deg);
}
.cabinet-side.down {
  background: #222;
  transform-origin: bottom;
  transform: rotateX(90deg);
}
.cabinet-side.left {
  width: 280px;
  height: 600px;
  background: #42544c;
  transform-origin: left;
  transform: translateZ(-280px) rotateY(-90deg);
}
.cabinet-side.right {
  width: 280px;
  height: 600px;
  background: #888;
  transform-origin: right;
  transform: translate3d(0, 40px, -40px) rotateY(-90deg);
}
.cabinet-side.back {
  background: #444;
  transform: translateZ(-280px);
}
.cabinet-shadow {
  width: 240px;
  height: 400px;
  background: linear-gradient(#666, #fff0);
  transform-origin: bottom;
  transform: translateY(200px) translateZ(400px) rotateX(90deg);
}

.d-1 { top: 40px; }
.d-2 { top: 200px; }
.d-3 { top: 360px; }

.drawer {
  position: absolute;
  width: 180px;
  left: 30px;
  transform-style: preserve-3d;
  transform: translateZ(5px);
}

.drawer.open {
  animation-duration: 700ms;
  animation-name: open;
  animation-timing-function: linear;
  animation-delay: 0s;
  animation-iteration-count: 1;
  animation-direction: normal;
  animation-fill-mode: both;
  animation-play-state: running;
}

.drawer.body {
  height: 120px;
  bottom: 5px;
  background: #f5f5dc;
  border-bottom: 3px solid #474838;
  box-sizing: border-box;
}
.sign {
  position: absolute;
  font-size: 45px;
  font-family: 'Bungee', cursive;
  left: 120px;
  color: white;
  padding: 5px;
  background: rgba(33, 66, 99, 0.5);
  border-radius: 15px;
  text-align: center;
  word-wrap: break-word;
  word-break: break-all;
  transform-origin: left;
  transform: translateZ(40px) rotateY(-90deg);
  transition: opacity 1s;
}
.sign:before {
  content: "";
  width: 0px;
  height: 0px;
  position: absolute;
  border-left: 5px solid transparent;
  border-right: 5px solid rgba(33, 66, 99, 0.5);
  border-top: 5px solid rgba(33, 66, 99, 0.5);
  border-bottom: 5px solid transparent;
  left: -10px;
  top: 12px;
}
.sign.hidden {
  transition: opacity 0s;
  opacity: 0;
}

.grip {
  position: absolute;
  width: 40px;
  height: 10px;
  border: 5px solid #474838;
  border-top: 10px solid #474838;
  border-radius: 3px;
  left: 70px;
  top: 30px;
}
.body-side {
  position: absolute;
  width: 20px;
  height: 120px;
  left: 0;
  bottom: -3px;
  background: #474838;
  transform-origin: left;
  transform: translateZ(-20px) rotateY(-90deg);
}
.body-side.short {
  width: 5px;
  transform: translateZ(-5px) rotateY(-90deg);
}
.body-top {
  position: absolute;
  width: 100%;
  height: 20px;
  background: #ACAC9A;
  transform-origin: top;
  transform: translateZ(-20px) rotateX(90deg);
}
.body-top.short {
  height: 5px;
  transform: translateZ(-5px) rotateX(90deg);
}
.drawer-side {
  position: absolute;
  background: #42544c;
  width: 260px;
  height: 90px;
  bottom: 0;
  transform-style: preserve-3d;
}
.drawer-side.left {
  left: 0;
  transform-origin: left;
  transform: translate3d(5px, -5px, -265px) rotateY(-90deg);
}
.drawer-side.right {
  right: 0;
  transform-origin: right;
  transform: translateX(-5px) translateZ(-20px) rotateY(-90deg);
}
.side-top {
/*   background: #54ff9e; */
  width: 260px;
  height: 5px;
  position: absolute;
  top: 0;
  transform-origin: top;
  transform: translateZ(-5px) rotateX(90deg);
}

.drawer-bottom {
  position: absolute;
  width: 170px;
  height: 260px;
  bottom: 0;
  background: beige;
  transform-origin: bottom;
  transform: translate3d(5px, -5px, -20px) rotateX(90deg);
}
.file-wrapper {
  width: 160px;
  height: 130px;
  bottom: -10px;
  position: absolute;
  transform-style: preserve-3d;
  transform-origin: left;
  transform: rotateY(90deg);
}
.file {
  position: absolute;
  left: 10px;
  width: 100%;
  height: 100%;
}
.cover {
  position: absolute;
  width: 100%; height: 100px;
  left: 10px; top: 20px;
  transform: translateZ(10px);
  background: red;
}
.paper-top {
  position: absolute;
  width: 146px;
  height: 10px;
  left: 10px;
  background: white;
  transform-origin: top;
  transform: translateX(2px) translateY(22px) rotateX(90deg);
}
.paper-side {
  position: absolute;
  width: 10px; height: 94px;
  left: 10px;
  background: #999;
  transform-origin: left;
  transform: translateX(2px) translateY(22px) rotateY(-90deg);
}
.red { fill: #FB475E; }
.blue { fill: #019992; }
.yellow { fill: #FFB001; }
.cover.red { background: #FB475E; }
.cover.blue { background: #019992; }
.cover.yellow { background: #FFB001; }

@keyframes open {
	0% {
		transform: translateZ(5px);
	}

	12% {
		transform: translateZ(28.314px);
	}

	24% {
		transform: translateZ(113.256px);
	}

	36% {
		transform: translateZ(254.826px);
	}

  54% {
		transform: translateZ(195.052px);
	}

	74% {
		transform: translateZ(255.762px);
	}

  82% {
		transform: translateZ(243.75px);
	}

	92% {
		transform: translateZ(258.284px);
	}

  96% {
		transform: translateZ(255.996px);
	}

  100% {
		transform: translateZ(260px);
	}

}

@keyframes swing {
  0% {
    transform: rotateZ(3deg);
  }
  
  30% {
    transform: rotateZ(0deg);
  }
  
  50% {
    transform: rotateZ(-3deg);
  }
  
  70% {
    transform: rotateZ(0deg);
  }
  
  85% {
    transform: rotateZ(1deg);
  }
  
  100% {
    transform: rotateZ(0deg);
  }
}

.github-link {
  position: fixed;
  right: 10px;
  bottom: 10px;
}

.link {
  font-family: 'Bungee', cursive;
  color: black;
  text-decoration: none;
}
.link:hover {
  color: #336699;
}
              
            
!

JS

              
                const dirNames = [
  'Documents',
  'Pictures',
  'Applications',
  'Music',
  'Desktop',
  'Downloads',
]

const flicking = new eg.Flicking('#flick', {
  circular: true,
  gap: 100,
  anchor: '0%',
  hanger: '20%',
  duration: 300,
  overflow: true,
  moveType: { type: 'snap', count: 5 }
})
.on('moveStart', e => {
  flicking.getPanel(0).update(el => {
    el.classList.remove("stop");
    el.classList.add("move");
  });
  
  const panel = flicking.viewport.getNearestPanel(); 
  const panelEl = panel.getElement();
  panelEl.querySelectorAll(".drawer").forEach(el => {
    el.classList.remove("open");
  });
  panelEl.querySelector('.sign').classList.add('hidden');
})
.on('moveEnd', e => {
  flicking.getPanel(0).update(el => {
    el.classList.add("stop");
    el.classList.remove("move");
  });
  
  const panel = flicking.viewport.getNearestPanel(); 
  const panelEl = panel.getElement();
  panelEl.querySelectorAll(".d-1.drawer").forEach(el => {
    el.classList.add("open");
  });
  const signEl = panelEl.querySelector('.sign');
  signEl.classList.remove('hidden');
  signEl.innerHTML = dirNames[Math.floor(Math.random() * dirNames.length)];
})
.on('select', e => e.panel.focus(500));

flicking.getAllPanels(true).slice(2).forEach(panel => {
  panel.getElement().querySelectorAll('.file-wrapper').forEach(el => el.remove());
})

              
            
!
999px

Console