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.


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.


                <div class="overflow">
<div id="play-button-container">
<svg id="button-circle-svg" viewBox="0 0 100 100">
  <style type="text/css">	
    .st0 { 
      fill: #DDDDDD;
      stroke-width: 0px;
  <circle id="button-circle"
    class="st0" cx="50" cy="50" r="50"/>
<svg id="play-triangle-svg" viewBox="0 0 100 100">
    #play-triangle {
      fill: black;
    #triangle-tween-target {
      display: none;
  <polygon id="play-triangle" points="37,74.1 76.8,51.1 37,28.2 "/>
<rect id="triangle-tween-target" x="47.6" y="46.7" width="16" height="9"/>
<iframe id="youtube-video" width="560" height="315" src="" frameborder="0" gesture="media" allow="encrypted-media" allowfullscreen></iframe>
  <div class="video-text">
    Watch Video



  width: 100vw
  height: 100vh
  overflow: hidden

  position: relative
  top: 100px
  left: 200px
  width: 100px
  height: 100px
    cursor: pointer
  position: absolute
  top: 0
  left: 0
  position: absolute
  top: 0
  left: 0
  opacity: 0
  pointer-events: none
    pointer-events: auto
  padding-top: 110px
  text-align: center
  font-family: Arial


                var $triangleTweenTarget = $('#triangle-tween-target');
var $playTriangle = $('#play-triangle');

var clicked = false;
// In the next line, .progress(1).pause(0) is a tip from @greensock to force processing of morphs immediately
var morph ='#play-triangle', 0.5, 
                        { morphSVG: $triangleTweenTarget,
                          scale: 5,
                          transformOrigin: "center center"
var $pbContainer = $('#play-button-container');
var $buttonCircleSvg = $('#button-circle-svg');
var $buttonCircle = $('#button-circle');
var $playTriangleSvg = $('#play-triangle-svg');
$pbContainer.on('click', function(){
    clicked =true;$buttonCircleSvg, 0.2, {scale: getScale(), opacity: 0.8});$buttonCircle, 0.5, {fill: '#333333'});;$playTriangleSvg, 0.5, 
                { width: $(window).width(), 
                  height: $(window).height(),
                  x: -1 * $pbContainer.offset().left,
                  y: -1 * $pbContainer.offset().top,
                  onStart: playVideo,
                  onComplete: moveVideo
  } else {
    clicked = false;$buttonCircleSvg, 0.5, {scale: 1});
    morph.reverse();$buttonCircle, 0.5, {fill: '#DDDDDD'});$playTriangleSvg, 0.5, 
                { width: $pbContainer.width(), 
                  height: $pbContainer.height(),
                  x: 0,
                  y: 0,
                  scale: 1,
                  onStart: stopVideo
  //get the minimum scale for the play button to cover the screen
  function getScale() {
    let buttonPosition = 
        { x: $playTriangleSvg.offset().left + ($playTriangleSvg.width()/2),
          y: $playTriangleSvg.offset().top + ($playTriangleSvg.height()/2)
    let $window = $(window);
    let farthestCorner = 
        { x: (buttonPosition.x > $window.width() / 2) ? 0 : $window.width(),
          y: (buttonPosition.y > $window.height() / 2) ? 0 : $window.height()
    let a = Math.abs(buttonPosition.x - farthestCorner.x);
    let b = Math.abs(buttonPosition.y - farthestCorner.y);
    let hypotenuse = Math.sqrt(a*a + b*b);
    return hypotenuse / ($playTriangleSvg.width() / 2);
  function playVideo() {
  var $youtubeVideo = $('#youtube-video');
  var $playTriangle = $('#play-triangle');
  function moveVideo() {   
    let pbcOffset = $pbContainer.offset();  
    let boundingBox = $playTriangle[0].getBoundingClientRect();
                 { x: boundingBox.left - pbcOffset.left, 
                   y: -,
                   width: boundingBox.width,
                   height: boundingBox.height});
  function showVideo() {$youtubeVideo, 0.3, {opacity: 1});
  function stopVideo() {    
    $youtubeVideo.removeClass('-visible');$youtubeVideo, 0, {opacity: 0});

var player;
function onYouTubeIframeAPIReady() {
  player = new YT.Player('youtube-video');