Pen Settings



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


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


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.


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.


  <div id="picker" class="picker">
    <div class="cell">
      <div class="cell-content">Card 1</div>
    <div class="cell">
      <div class="cell-content">Card 2</div>
    <div class="cell">
      <div class="cell-content">Card 3</div>
    <div class="cell">
      <div class="cell-content">Card 4</div>
    <div class="cell">
      <div class="cell-content">Card 5</div>
    <div class="cell">
      <div class="cell-content">Card 6</div>
    <div class="cell">
      <div class="cell-content">Card 7</div>



                * {
  box-sizing: border-box;

html, body {
  height: 100%;
  min-height: 100%;
  font-family: Roboto,sans-serif;
  background: #e2e0e0;

main {
  display: flex;
  position: relative;
  flex-direction: column;
  width: 100vw;
  height: 100vh;
  overflow: hidden;
  align-items: center;
  justify-content: center;

.cell {  
  position: absolute;
  top: 0;
  left: 0;
  width: 100%;
  font-size: 26px;
  font-weight: 500;
  color: rgba(0,0,0,0.87);
  color: rgba(0,0,0,0.92);
  user-select: none;  
  display: flex;
  align-items: center;
  justify-content: center;    
  background: #eee;
  height: 100%;
  transform-origin: center bottom;

.cell-content {}

.picker {
  position: relative;
  overflow: hidden;  
  width: 80vw; //225px;
  height: 90vh;
  border-radius: 2px;
  background-color: #fff;  
    0 2px 4px -1px rgba(0,0,0,.2), 
    0 4px 5px 0 rgba(0,0,0,.14), 
    0 1px 10px 0 rgba(0,0,0,.12);



	  ease: "none"

  var picker = document.querySelector(".picker");
  var cells = document.querySelectorAll(".cell");
  var proxy = document.createElement("div");

  var cellWidth = window.innerWidth * 0.5;
  var widthSnap = gsap.utils.snap(cellWidth);
  var rotation = -90;

  var numCells = cells.length;
  var cellStep = 1 / numCells;
  var wrapWidth = cellWidth * numCells;

  var baseTl = gsap.timeline({ paused: true });

  gsap.set(picker, {
    perspective: 1100,
    width: wrapWidth - cellWidth

  for (var i = 0; i < cells.length; i++) {  
    initCell(cells[i], i);

  var animation = gsap.timeline({ repeat: -1, paused: true })
    .add(baseTl.tweenFromTo(0.929, 1.929)).progress(1);

  var draggable = new Draggable(proxy, {  
    allowContextMenu: true,  
    type: "x",
    trigger: picker,
    inertia: true,
    onDrag: updateProgress,
    onThrowUpdate: updateProgress,
    snap: { 
      x: snapX
    onThrowComplete: function(){
 //     console.log("onThrowComplete");
      //TODO: animation that inject selected card title

  function snapX(x) {
    let current = widthSnap(this.x);
    return gsap.utils.snap([current - cellWidth, current, current + cellWidth], x);

  function updateProgress() {  
    let newProg = this.x / wrapWidth;
    newProg = newProg - Math.floor(newProg);
//    console.log(newProg);

  function initCell(element, index) {

    gsap.set(element, {
      width: cellWidth,
      scale: 0.5,
      rotation: rotation,
      x: -cellWidth

    var tl = gsap.timeline({ repeat: 1 })
      .to(element, 1, { x: "+=" + wrapWidth, rotation: -rotation}, 0)
      .to(element, cellStep, {scale: 1, repeat: 1, yoyo: true }, 0.5 - cellStep)

    baseTl.add(tl, i * -cellStep);