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

              
                <div class="video-wrapper">
  <video class="video-js" preload="auto" muted playsinline></video>
  <div class="video-inner">
    <span></span>
    <ul>
      <li>
        <div class="inner">          
          <h2>1-3 seconds</h2>
          <p>テキストをひょうじ</p>
        </div>
      </li>
      <li>
        <div class="inner">          
          <h2>5-8 seconds</h2>
          <p>5びょうめから8びょうめ</p>
        </div>
      </li>
      <li>
        <div class="inner">          
          <h2>9-11 seconds</h2>
          <p>ぜんたいにフィルターをかける</p>
        </div>
      </li>
      <li>
        <div class="inner">          
          <h2>12-16 seconds</h2>
          <div class="content">
            <div class="balloon_wrapper">
              <p class="balloon3">がぞうと<br>テキストを<br>かさねてみる</p>
            </div>
            <img src="https://homemadegarbage.com/assets/images/icon-dolphin.png" alt="">
          </div>
        </div>
      </li>
      <li>
        <div class="inner">          
          <h2>17- seconds</h2>
          <p>END...フェードアウト</p>
        </div>
      </li>
      <li><!-- フェードアウト用要素--></li>
    </ul>
  </div>
</div>
  

              
            
!

CSS

              
                body {
  margin: 0;
}

/* ビデオ */
.video-wrapper {
  width: 100%;
  position: relative;
  padding-top: 56.25%;
  background: none;
}
#vjs_video_3 {
  display: block;
  position: absolute;
  top: 0;
  left: 0;
  z-index: 1;
  width: 100%;
  height: 100%;
  background: none;
}

/* 動画の上に表示する要素のスタイル */
.video-inner {
  position: absolute;
  top: 0;
  width: 100%;
  height: 100%;
  z-index: 1;
  color: white;
  text-align: center;
}
.video-inner li {
  font-size: 2rem;
  opacity: 0;
  position: absolute;
  top: 0;
  Left: 0;
  bottom: 0;
  width: 100%;
}
.video-inner li .inner {
  position: relative;
}
.video-inner li:nth-child(3) {
  background: rgba(0,0,0,.5)
}

h2 {
  font-family: 'Cabin Sketch', cursive;
}
p,span {
  font-family: "Nico Moji";
}
img {
  position: absolute;
  left: 50%;
}
span {
  position: absolute;
  right: 1rem;
  top: 1rem;
  z-index: 2;
}
.content {
  width: 90%;
  height: 90%;
  text-align: center;
  margin: auto;
  position: relative;
}
/* 吹き出し */
.balloon_wrapper {
  position: absolute;
  left: 10%;
  margin-top: -1rem;
}
.balloon3{
  position: relative;
  padding: 8%;
  width: 120px;
  height: 80px;
  padding: 1rem;
  border-radius: 30px;
  text-align: center;
  color: #ffffff;
  letter-spacing: 0.2em;
  font-size: 14px;
  background-color: #6baad4;
  text-align: center;
  box-sizing: border-box;
}
.balloon3::before{
  content: '';
  position: absolute;
  display: block;
  width: 0;
  height: 0;
  right: 2px;
  bottom: 2px;
  border-right: 20px solid #6baad4;
  border-top: 10px solid transparent;
  border-bottom: 10px solid transparent;
  transform: rotate(-45deg);
}
/* フェードアウト */
li:nth-child(6) {
  background: #000;
}
 

@media only screen and (min-width: 750px) {
  h2 {
    font-size: 5rem;
  }
  .balloon_wrapper {
    left: 25%;
  }
  img {
    left: 0;
    right: 0;
    margin: auto;
  }
  .content {
    width: 60%;
  }
}
              
            
!

JS

              
                // videojs
var player = videojs(document.querySelector('video'), {
  autoplay: true,
	preload: true,
  loop: true
});
player.ready(function () {
  player.src({
	src: 'http://homemadegarbage.com/demo/assets/mov.mp4'
	});
});

// 表示切り替え
var speed = 1000;
var showElement = function(e,start,end) {
  showElement.time == start && $(e).animate({ opacity: 1 }, speed);
  end && showElement.time == end && $(e).animate({ opacity: 0 }, speed);  
};

var prevTime = 0;
player.on('timeupdate', function () {
  $('span').text(player.currentTime());
  var currentTime = Math.floor(player.currentTime());
  if (currentTime != prevTime) {
    currentTime == 0 && $('.video-inner li').css('opacity','0');
    showElement.time = currentTime;
    showElement('.video-inner li:nth-child(1)',1,3);
    showElement('.video-inner li:nth-child(2)',5,8);
    showElement('.video-inner li:nth-child(3)',9,11);
    showElement('.video-inner li:nth-child(4)',12,16);
    showElement('.video-inner li:nth-child(5)',17);
    showElement('.video-inner li:nth-child(6)',19);
  }
  prevTime = currentTime;
});


              
            
!
999px

Console