The content on this website, including videos and code examples, is for educational purposes only. All demonstrations and designs are fictional and created to illustrate coding techniques. Any resemblance to existing websites or brands is purely coincidental.
The creators and administrators of this website do not claim ownership or affiliation with any existing websites or companies. Users are encouraged to use the information responsibly for learning purposes. Liability for any misuse of the content provided is not accepted.
Below is the html code for this video.
index.html
<!DOCTYPE html>
<html lang="en">
<head>
<meta charset="UTF-8">
<meta name="viewport" content="width=device-width, initial-scale=1.0">
<title>Slideshow Ken Burns Effect</title>
<link rel="stylesheet" href="style.css">
</head>
<body>
<h1><small>Slideshow</small>Ken Burns<small>Effect</small></h1>
<div class="slideshow-container">
<div class="slide"></div>
<div class="slide"></div>
<div class="slide"></div>
<div class="slide"></div>
</div>
</body>
</html>
Below is the css code for this video.
style.css
* {
margin: 0;
padding: 0;
}
body {
height: 100vh;
width: 100%;
overflow: hidden;
}
h1 {
position: absolute;
top: 50%;
left: 50%;
transform: translate(-50%, -50%);
background-color: #ffffffbf;
text-align: center;
font-weight: 300;
text-transform: uppercase;
line-height: 2;
border-radius: 8px;
box-shadow: 0 0 10px #00000040;
padding: 4.5% 8%;
z-index: 5;
animation: textBgAnim 1s ease-in-out infinite;
}
@keyframes textBgAnim {
0%, 10%, 90%, 100% {
background-color: #ffffffbf;
}
40%, 60% {
background-color: #ffffff40;
}
}
h1 small {
display: block;
font-size: 0.5em;
font-family: monospace;
text-transform: lowercase;
}
h1 small:first-child {
border-bottom: 1px solid #00000040;
padding-bottom: 0.5em;
letter-spacing: 5px;
}
h1 small:last-child {
border-top: 1px solid #00000040;
padding-top: 0.5em;
letter-spacing: 10px;
}
.slideshow-container {
position: absolute;
height: 100%;
width: 100%;
overflow: hidden;
}
.slide {
position: absolute;
transform: scale(1.25);
height: 100%;
width: 100%;
background-position: center;
background-repeat: no-repeat;
background-size: cover;
animation-duration: 16s;
animation-iteration-count: infinite;
opacity: 1;
}
.slide:nth-child(1) {
background-image: url(https://images.unsplash.com/photo-1512460252311-ef21bd8dfa45?ixlib=rb-4.0.3&ixid=M3wxMjA3fDB8MHxwaG90by1wYWdlfHx8fGVufDB8fHx8fA%3D%3D&auto=format&fit=crop&w=1470&q=80);
animation-name: kenBurns1;
z-index: 3;
}
@keyframes kenBurns1 {
0% {
opacity: 1;
transform: scale(1.25);
}
1.5%, 23.5% {
opacity: 1;
}
26.5% {
opacity: 0;
transform: scale(1);
}
100% {
opacity: 0;
transform: scale(1.25);
}
98.5% {
opacity: 0;
transform: scale(1.225);
}
100% {
opacity: 1;
}
}
.slide:nth-child(2) {
background-image: url(https://images.unsplash.com/photo-1500699265491-193ed3f159b0?ixlib=rb-4.0.3&ixid=M3wxMjA3fDB8MHxwaG90by1wYWdlfHx8fGVufDB8fHx8fA%3D%3D&auto=format&fit=crop&w=1470&q=80);
animation-name: kenBurns2;
z-index: 2;
}
@keyframes kenBurns2 {
23.5% {
opacity: 1;
transform: scale(1.25);
}
26.5%, 48.5% {
opacity: 1;
}
51.5% {
opacity: 0;
transform: scale(1);
}
100% {
opacity: 0;
transform: scale(1.25);
}
}
.slide:nth-child(3) {
background-image: url(https://images.unsplash.com/photo-1501631259223-89d4e246ed23?ixlib=rb-4.0.3&ixid=M3wxMjA3fDB8MHxwaG90by1wYWdlfHx8fGVufDB8fHx8fA%3D%3D&auto=format&fit=crop&w=1482&q=80);
animation-name: kenBurns3;
z-index: 1;
}
@keyframes kenBurns3 {
48.5% {
opacity: 1;
transform: scale(1.25);
}
51.5%, 73.5% {
opacity: 1;
}
76.5% {
opacity: 0;
transform: scale(1);
}
100% {
opacity: 0;
transform: scale(1.25);
}
}
.slide:nth-child(4) {
background-image: url(https://images.unsplash.com/photo-1622610607501-32ac9c927216?ixlib=rb-4.0.3&ixid=M3wxMjA3fDB8MHxwaG90by1wYWdlfHx8fGVufDB8fHx8fA%3D%3D&auto=format&fit=crop&w=1471&q=80);
animation-name: kenBurns4;
z-index: 0;
}
@keyframes kenBurns4 {
73.5% {
opacity: 1;
transform: scale(1.25);
}
76.5%, 98.5% {
opacity: 1;
}
100% {
opacity: 0;
transform: scale(1);
}
}
Thanks for visiting