画面を斜めに分割して2つの動画を表示する

Ads

Result


画面を斜めに分割して動画を2つ同時に再生するサンプルです

css

body {
  background-color: black;
   overflow:hidden;
}

.parent {
  position: relative;
  height: 100vh;
  width: 100vw;
}

.video {
  position: absolute;
  top: -8px;
  left: -8px;
  width: 100%;
  height: 100vh;
  background-position: center;
  background-size: cover;
  overflow: hidden;
}

.clip-video {
  clip-path: polygon(99.9% 0, 0 99.9%, 0 0);
}

.clip-video-reverse {
  clip-path: polygon(100% 0.1%, 0.1% 100%, 100% 100%);
}

.logo {
  position: absolute;
  top: 50%;
  left: 50%;
  transform: translate(-50%, -50%);
}
.video:hover::after {
  content: '';
  background-color: #00000055;
  position: absolute;
  top: 0;
  left: 0;
  height: 100%;
  width: 100%;
}

2つの動画を重ね、clip-pathで斜めにくり抜き、下のレイヤーの動画を表示

html

<div class="parent">
      <div class="video video1 clip-video">
         <video class="video-container" autoplay loop muted>
            <source src="https://staging.coverr.co/s3/mp4/Road-candies.mp4">
         </video>
      </div>
      <div class="video video2 clip-video-reverse">
         <video class="video-container" autoplay loop muted>
            <source src="https://staging.coverr.co/s3/mp4/Travaho.mp4">
         </video>
      </div>

   <div class='logo'>
      <img src="https://via.placeholder.com/180x180">
   </div>
   <div class="title video1-title"></div>
   <div class="title video2-title"></div>
</div>

via

Two videos separated diagonally