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 http-equiv="X-UA-Compatible" content="IE=edge">
<meta name="viewport" content="width=device-width, initial-scale=1.0">
<title>Happy Republic Day</title>
<link rel="stylesheet" href="style.css">
</head>
<body>
<div class="container">
<h1>Happy</h1>
<h1>Rep<span>U</span>blic</h1>
<h1>Day</h1>
</div>
<div id="tricolor-balloon-container"></div>
<script src="index.js"></script>
</body>
</html>
Below is the css code for this video.
style.css
* {
margin: 0;
padding: 0;
box-sizing: border-box;
}
body {
height: 100vh;
width: 100%;
background: radial-gradient(#c3dce8, #8eb2dc, #5595c9);
overflow: hidden;
}
.container {
position: absolute;
top: 50%;
left: 50%;
transform: translate(-50%, -50%);
width: 50%;
z-index: 1;
}
h1 {
color: #ffffff;
font-size: 48px;
text-transform: uppercase;
font-family: sans-serif;
letter-spacing: 10px;
text-align: center;
margin: 10vh 0;
text-shadow: 1px 1px 0 #ffffffbf, 2px 2px 0 #000080, 3px 3px 0 #ffffff80, 4px 4px 0 #000080, 5px 5px 0 #ffffff40;
animation: textAnim 1.5s ease-in-out infinite;
}
h1 span {
color: #000080;
text-shadow: 1px 1px 0 #000080bf, 2px 2px 0 #ffffff, 3px 3px 0 #00008080, 4px 4px 0 #ffffff, 5px 5px 0 #00008040;
}
h1:first-child {
font-size: 82px;
color: #ff9933;
text-shadow: 1px 1px 0 #ff9933bf, 2px 2px 0 #ffffff, 3px 3px 0 #ff993380, 4px 4px 0 #ffffff, 5px 5px 0 #ff993340;
}
h1:last-child {
font-size: 154px;
color: #138808;
text-shadow: 1px 1px 0 #138808bf, 2px 2px 0 #ffffff, 3px 3px 0 #13880880, 4px 4px 0 #ffffff, 5px 5px 0 #13880840;
}
@keyframes textAnim {
0% {
transform: scale(1.25);
}
15% {
transform: scale(1.5);
}
30% {
transform: scale(1.25);
}
45% {
transform: scale(1.5);
}
50%, 100% {
transform: scale(1.25);
}
}
#tricolor-balloon-container {
display: flex;
flex-wrap: wrap;
height: 100vh;
padding: 15px;
overflow: hidden;
transition: opacity 0.5s ease;
}
.balloon {
position: relative;
height: 125px;
width: 105px;
border-radius: 75% 75% 70% 70%;
}
.balloon::before {
content: "";
position: absolute;
top: 125px;
left: 0;
right: 0;
display: block;
height: 75px;
width: 1px;
background: #00000040;
padding: 1px;
margin: auto;
}
.balloon::after {
content: "▲";
position: absolute;
top: 115px;
left: 0;
right: 0;
display: block;
color: inherit;
text-align: center;
margin: auto;
}
@keyframes floatBalloonAnim {
from {
opacity: 1;
transform: translateY(100vh);
}
to {
opacity: 0;
transform: translateY(-100vh);
}
}
Below is the javascript code for this video.
index.js
const tricolorBalloonContainer = document.getElementById("tricolor-balloon-container");
function createBalloons(numberOfBalloons) {
for (let i = 0; i < numberOfBalloons; i++) {
var balloon = document.createElement("div");
balloon.className = "balloon";
balloon.style.cssText = getRandomBalloonWithStyle();
tricolorBalloonContainer.append(balloon);
}
}
function getRandomBalloonWithStyle() {
const colorOfBalloons = ["255, 153, 51", "255, 255, 255", "0, 0, 128", "19, 136, 8"];
var randomColor = Math.floor(Math.random() * colorOfBalloons.length);
var marginTop = Math.floor(Math.random() * 200);
var marginLeft = Math.floor(Math.random() * 50);
var durationOfAnimation = Math.floor(Math.random() * 5) + 5;
return `background-color: rgba(${colorOfBalloons[randomColor]}, 0.75);
color: rgba(${colorOfBalloons[randomColor]}, 0.75);
box-shadow: inset -7px -3px 10px rgba(${colorOfBalloons[randomColor]}, 0.75);
margin: ${marginTop}px 0 0 ${marginLeft}px;
animation: floatBalloonAnim ${durationOfAnimation}s ease-in-out infinite;`
}
window.addEventListener("load", () => { createBalloons(26) });
Thanks for visiting