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>Snowy New Year Celebration</title>
<link rel="stylesheet" href="style.css">
</head>
<body>
<div class="background"></div>
<div class="content-container">
<h1 id="new-year-heading">Happy New Year</h1>
<p id="year-digits"><span>2</span><span>0</span><span>2</span><span id="year-last-digit">3</span></p>
</div>
<script src="index.js"></script>
</body>
</html>
Below is the css code for this video.
style.css
@import url('https://fonts.googleapis.com/css2?family=Neonderthaw&family=Poiret+One&display=swap');
* {
margin: 0;
padding: 0;
transition: all 0.5s ease;
}
body {
height: 100vh;
width: 100%;
background-image: url("https://images.unsplash.com/photo-1550684849-39df3781f7b0?q=80&w=2940&auto=format&fit=crop&ixlib=rb-4.0.3&ixid=M3wxMjA3fDB8MHxwaG90by1wYWdlfHx8fGVufDB8fHx8fA%3D%3D");
background-position: center;
background-repeat: no-repeat;
background-size: cover;
overflow: hidden;
}
.content-container {
display: flex;
height: 100%;
width: 100%;
background: #000000bf;
color: #ffffff;
flex-direction: column;
justify-content: center;
align-items: center;
text-transform: capitalize;
}
#new-year-heading {
display: none;
font-size: 7vw;
font-family: 'Poiret One', sans-serif;
letter-spacing: 7px;
animation: colorAnim 10s ease-in-out infinite;
}
#year-digits {
font-size: 15vw;
font-family: 'Neonderthaw', 'Poiret One', cursive;
letter-spacing: 15px;
text-shadow: 0 0 5px #fffff0, 0 0 25px #fffff0, 0 0 50px #fffff0, 0 0 100px #fffff0, 0 0 200px #fffff0;
animation: colorAnim 10s ease-in-out 1s infinite;
}
.snow {
position: absolute;
top: -10%;
border-radius: 50%;
}
.snow-animation1 {
animation: snowAnim linear infinite, snowFall1 linear infinite;
}
.snow-animation2 {
animation: snowAnim linear infinite, snowFall2 linear infinite;
}
.snow-animation3 {
animation: snowAnim linear infinite, snowFall3 linear infinite;
}
.snow-animation4 {
animation: snowAnim linear infinite, snowFall4 linear infinite;
}
@keyframes snowFall1 {
0% {
transform: translate(0vw, 0vh);
}
100% {
transform: translate(50vw, 150vh);
}
}
@keyframes snowFall2 {
0% {
transform: translate(-10vw, -10vh);
}
100% {
transform: translate(50vw, 150vh);
}
}
@keyframes snowFall3 {
0% {
transform: translate(10vw, 0vh);
}
100% {
transform: translate(60vw, 150vh);
}
}
@keyframes snowFall4 {
0% {
transform: translate(0vw, 0vh);
}
100% {
transform: translate(40vw, 150vh);
}
}
@keyframes snowAnim {
0% {
background-color: #fffff0;
box-shadow: 0 0 20px #fffff0, 0 0 50px #fffff0;
}
14.285% {
background-color: #93c572;
box-shadow: 0 0 20px #93c572, 0 0 50px #93c572;
}
28.57% {
background-color: #e97451;
box-shadow: 0 0 20px #e97451, 0 0 50px #e97451;
}
42.855% {
background-color: #f33a6a;
box-shadow: 0 0 20px #f33a6a, 0 0 50px #f33a6a;
}
57.14% {
background-color: #5d3fd3;
box-shadow: 0 0 20px #5d3fd3, 0 0 50px #5d3fd3;
}
71.425% {
background-color: #0437f2;
box-shadow: 0 0 20px #0437f2, 0 0 50px #0437f2;
}
85.71% {
background-color: #d2042d;
box-shadow: 0 0 20px #d2042d, 0 0 50px #d2042d;
}
100% {
background-color: #ffd700;
box-shadow: 0 0 20px #ffd700, 0 0 50px #ffd700;
}
}
@keyframes colorAnim {
0% {
text-shadow: 0 0 5px #fffff0, 0 0 25px #fffff0, 0 0 50px #fffff0, 0 0 100px #fffff0, 0 0 200px #fffff0;
}
14.285% {
text-shadow: 0 0 5px #93c572, 0 0 25px #93c572, 0 0 50px #93c572, 0 0 100px #93c572, 0 0 200px #93c572;
}
28.57% {
text-shadow: 0 0 5px #e97451, 0 0 25px #e97451, 0 0 50px #e97451, 0 0 100px #e97451, 0 0 200px #e97451;
}
42.855% {
text-shadow: 0 0 5px #f33a6a, 0 0 25px #f33a6a, 0 0 50px #f33a6a, 0 0 100px #f33a6a, 0 0 200px #f33a6a;
}
57.14% {
text-shadow: 0 0 5px #5d3fd3, 0 0 25px #5d3fd3, 0 0 50px #5d3fd3, 0 0 100px #5d3fd3, 0 0 200px #5d3fd3;
}
71.425% {
text-shadow: 0 0 5px #0437f2, 0 0 25px #0437f2, 0 0 50px #0437f2, 0 0 100px #0437f2, 0 0 200px #0437f2;
}
85.71% {
text-shadow: 0 0 5px #d2042d, 0 0 25px #d2042d, 0 0 50px #d2042d, 0 0 100px #d2042d, 0 0 200px #d2042d;
}
100% {
text-shadow: 0 0 5px #ffd700, 0 0 25px #ffd700, 0 0 50px #ffd700, 0 0 100px #ffd700, 0 0 200px #ffd700;
}
}
Below is the javascript code for this video.
index.js
const randomNumber = limit => Math.floor(Math.random() * limit);
const snowFall = () => {
const background = document.querySelector(".background");
for (let i = 0; i < 100; i++) {
const snow = document.createElement("span");
snow.classList.add("snow");
if (i % 4 === 0) { snow.classList.add("snow-animation1"); }
else if (i % 4 === 1) { snow.classList.add("snow-animation2"); }
else if (i % 4 === 2) { snow.classList.add("snow-animation3"); }
else { snow.classList.add("snow-animation4"); }
const num = -50 + randomNumber(150);
const timeDelay = randomNumber(10);
const animationDuration = 5 + randomNumber(10) + Math.random() + 0.25;
const snowOpacity = randomNumber(10) * 0.1;
const heightWidth = randomNumber(10) + 5;
snow.style.height = `${heightWidth}px`;
snow.style.width = `${heightWidth}px`;
snow.style.left = `${num}%`;
snow.style.opacity = `${snowOpacity}`;
snow.style.animationDuration = `${animationDuration}s`;
snow.style.animationDelay = `${timeDelay}s`;
background.appendChild(snow);
}
}
snowFall();
var run = 0;
setInterval(() => {
if (run === 0) {
document.getElementById("year-digits").style.display = "none";
document.getElementById("new-year-heading").style.display = "block";
run++;
} else if (run === 1) {
document.getElementById("year-digits").style.display = "block";
document.getElementById("year-last-digit").innerHTML = 4;
run++;
}
}, 10000);
Thanks for visiting