<figure id="fashion">
<video controls>
<source src="https://s3-us-west-2.amazonaws.com/s.cdpn.io/4273/fashion-export.webm">
<source src="https://thenewcode.com/assets/videos/fashion-export.mp4">
</video>
<div id="vid-cover"></div>
<figcaption>Summer Sale <span>Now On</span></figcaption>
</figure>
<button id="play-button">Play</button>
@keyframes overlay {
30% {
left: 0;
width: 50%;
}
50% {
background: #00f;
}
80% {
left: 80%;
width: 20%;
}
100% {
left: 60%;
width: 40%;
background: #00f;
}
}
body {
text-align: center;
margin: 0;
padding:0;
width: 100vw;
height: 100vh;
}
figure {
margin: 0;
}
figure#fashion video {
width: 100%;
}
figure#fashion div {
width: 10%;
height: 100%;
background: #f00;
position: absolute;
top: 0;
mix-blend-mode: multiply;
pointer-events: none;
left: 0;
bottom: 0;
}
video.playing ~ div#vid-cover {
animation: overlay 10s forwards;
}
figure#fashion video.playing ~ figcaption {
opacity: 1;
}
figure#fashion figcaption {
font-size: 50px;
font-family: Avenir;
color: white;
position: absolute;
width: 40%;
right: 0;
top: 30%;
text-transform: uppercase;
text-align: center;
opacity: 0;
transition: 3s 9s opacity;
}
figure#fashion figcaption span {
font-size: 40px;
text-transform: lowercase;
display: block;
}
button {
display: block;
margin: 0 auto;
font-size: 1.2rem;
position: absolute;
top: 50%;
left: 50%;
transform: translate(-50%, -50%);
}
View Compiled
var playbutton = document.getElementById("play-button");
var fashion = document.querySelector("#fashion video");
fashion.removeAttribute("controls");
playbutton.addEventListener("click", function() {
fashion.play();
fashion.classList.add("playing");
})
This Pen doesn't use any external CSS resources.