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. You can use the CSS from another Pen by using it's URL and the proper URL extention.

+ 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

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

              
                <div id="config">
  <div id="mute"></div>
</div>
<div id="stage">
  <div id="carosel">
    <div class="screen">
      <div class="promo">
        <div id="frame1"></div>
      </div>
    </div>
    <div class="screen">
      <div class="promo">
        <div id="frame2"></div>
      </div>
    </div>
    <div class="screen">
      <div class="promo">
        <div id="frame3"></div>
      </div>
    </div>
    <div class="screen">
      <div class="promo">
         <div id="frame4"></div>
      </div>
    </div>
    <div class="screen">
      <div class="promo">
        <div id="frame5"></div>
      </div>
    </div>
    <div class="screen">
      <div class="promo">
        <div id="frame6"></div>
      </div>
    </div>
    <div class="screen">
      <div class="promo">
        <div id="frame7"></div>
      </div>
    </div>
    <div class="screen">
      <div class="promo">
        <div id="frame8"></div>
      </div>
    </div>
  </div>
</div>
              
            
!

CSS

              
                body {
  background: url('//i.ytimg.com/vi/UOH_mAE8LT0/maxresdefault.jpg') center / cover no-repeat fixed;
  font-family: Helvetica;
  text-shadow: -1px -1px 4px rgb(0 0 0 /.35);
  overflow-x: hidden;
}

#config {
  position: absolute;
  top: 0; right: 0;
  width: 320px; height: 200px;
  background: linear-gradient(to right top, transparent 50%, rgb(92 100 114 /.35) 50%);
}

#stage {
  position: absolute;
  top: 50%; left: 50%;
  transform: translate(-50%,-50%);
  perspective: 500px;
}

#carosel {
  /*The 42vw is from initial load of iframe html (does it update as it should)*/
  --radius: 42vw;
  width: calc(var(--radius)*2);
  height: calc(var(--radius)*1.25);
  transform: translateZ(calc(var(--radius)*-1));
  transform-style: preserve-3d;
}
/*
#carosel:after {
  content: '';
  position: absolute;
  width: inherit;
  height: inherit;
  background: rgba(0, 0, 0, .6);
  border-radius: 50%;
  transform: rotateX(90deg);
}
*/
/*Remov Visibility by turning TweenMax into CSS code*/
.screen {
  position: absolute;
  top: 50%; left: 50%;
  width: 25%; height: 25%;
  border: 5px inset rgb(29 203 84 /.75);
  box-shadow: 0 0 15px 3px rgb(110 72 221 /.9);
  transform-origin: 50% 50% calc(var(--radius)*-1);
  /* The -50%,-50% below is always correct. The var(--radius) not always*/
  transform: translate3d(-50%,-50%,var(--radius));
  transform-style: preserve-3d;
  visibility: hidden;
}

.screen:after {
  content: '';
  position: absolute;
  width: 100%; height: 100%;
  background: rgb(0 0 0 /.6);
  transform: rotateX(180deg);
  transform-origin: top;
  backface-visibility: hidden;
}
/*Remov Visibility by making animateIn a CSS animation*/
.promo {
  width: 100%; height: 100%;
  opacity: 0;
  color: aqua;
  font-size: 72px;
  transform-style: preserve-3d;
  display: flex;
  align-items: center;
  justify-content: center;
  overflow: hidden;
  visibility: visible;
  -webkit-box-reflect: below 10px -webkit-linear-gradient(bottom, rgb(0 0 0 /.33) 0%, transparent 40%);
}

iframe {
  pointer-events: none;
  width: 100%; height: 200%;
  transform: scale(1.1, 1.17);
}
              
            
!

JS

              
                var carosel, iscreen, radius, lens, mouseX=0, mouseY=0, addX=0;

$(document).ready(init);

function init() {
  carosel = $('#carosel');
  iscreen = $('.screen');
  lens = iscreen.length;
  radius = carosel.width/2;
  // set screen props
  for (let i = 0; i < lens; i++) {
    var item = iscreen.eq(i);
    var $s = 1 + randomInt(10);
    var $d = 1 - randomInt(8);

    TweenMax.set(item, {
      rotationY: 360/lens * i,
      delay: $d,
      autoAlpha: 1
    });
    TweenMax.to(item.find('.promo'), $s, {
      delay: $d,
      autoAlpha: 1
    });
  }
  // set mouse x & y props and looper ticker
  window.addEventListener("mousemove", onMouseMove = e => {
    mouseX = (window.innerWidth/2 - e.pageX)/400;
    mouseY = (window.innerHeight/2 - e.pageY)/100;
  });
  setInterval(looper, 15);
}

randomInt = $n =>
  Math.floor(Math.random()*$n + 1)/10;

// loops & sets carousel 3d properties
looper = () => {
  addX += mouseX;
  TweenMax.to(carosel, 1, {
    rotationY: addX,
    rotationX: mouseY,
  });
};

var tag = document.createElement('script');
tag.src = "//youtube.com/player_api";
var firstScriptTag = document.getElementsByTagName('script')[0];
firstScriptTag.parentNode.insertBefore(tag, firstScriptTag);

onYouTubePlayerAPIReady = () => {
  yt = new YT.Player('frame1', {
    playerVars: {
      autoplay: 1,
      playlist: '1-Gneo_8F1w'
    },
    videoId: '1-Gneo_8F1w',
    events: {
      onReady: onPlayerReady
    }
  });
  yt = new YT.Player('frame2', {
    playerVars: {
      autoplay: 1,
      start: 4,
      playlist: 'uU34kPPtzXY'
    },
    videoId: 'uU34kPPtzXY',
    events: {
      onReady: onPlayerReady
    }
  });
  yt = new YT.Player('frame3', {
    playerVars: {
      autoplay: 1,
      playlist: 'uH0hylgmrxM'
    },
    videoId: 'uH0hylgmrxM',
    events: {
      onReady: onPlayerReady
    }
  });
  yt = new YT.Player('frame4', {
    playerVars: {
      autoplay: 1,
      playlist: '1-Gneo_8F1w'
    },
    videoId: '1-Gneo_8F1w',
    events: {
      onReady: onPlayerReady
    }
  });
  yt = new YT.Player('frame5', {
    playerVars: {
      autoplay: 1,
      playlist: 'H6cDTVKHsek'
    },
    videoId: 'H6cDTVKHsek',
    events: {
      onReady: onPlayerReady
    }
  });
  yt = new YT.Player('frame6', {
    playerVars: {
      autoplay: 1,
      start: 16,
      end: 171,
      playlist: 'ShaAXbrgPfw'
    },
    videoId: 'ShaAXbrgPfw',
    events: {
      onReady: onPlayerReady
    }
  });
  yt = new YT.Player('frame7', {
    playerVars: {
      autoplay: 1,
      playlist: '1-Gneo_8F1w'
    },
    videoId: '1-Gneo_8F1w',
    events: {
      onReady: onPlayerReady
    }
  });
  yt = new YT.Player('frame8', {
    playerVars: {
      start: 189,
      autoplay: 1,
      end: 210,
      playlist: 'C5VLjgxJ2zk'
    },
    videoId: 'C5VLjgxJ2zk',
    events: {
      onReady: onPlayerReady
    }
  });
};

onPlayerReady = e =>
  e.target.setPlaybackQuality('small').setLoop(true).mute();
              
            
!
999px

Console