Happy New Year Project With CSS Animation

Wish your friend a Happy New Year 2022


Preview:


HTML Code:

index.html

<!DOCTYPE html>
<html>
<head>
    <meta charset="utf-8">
    <title>Happy New Year 2022</title>
    <link rel="stylesheet" type="text/css" href="style.css">
</head>
<body>
    <div class="loading">
        <h2>2021</h2>
        <div class="bar"></div>
        <h2>2022</h2>
    </div>
    <div class="center">
        <div><h2 class="one">Happy New Year</h2></div>
        <div></div>
        <div><h2 class="one">2022</h2></div>
        <div></div>
    </div>
</body>
</html>


CSS Code:

style.css

@import url('https://fonts.googleapis.com/css2?family=Poppins&display=swap');
body
{
    margin0;
    padding0;
    display: flex;
    justify-content: center;
    align-items: center;
    height100vh;
    overflow: hidden;
    font-family'Poppins', sans-serif;
}
.center
{
    position: relative;
    width400px;
}
.center div
{
    position: relative;
    height100px;
    margin-30px 0;
    z-index2;
    transform: skewY(-5deg);
    display: flex;
    justify-content: center;
    align-items: center;
}
.center div:nth-child(2),
.center div:nth-child(4)
{
    transform: skewY(14.5deg);
    z-index1;
}
.center div:nth-child(4)
{
    transform: skewY(25deg);
    transform-origin: left;
    top-52px;
}
.center div::before
{
    content'';
    position: absolute;
    width100%;
    height100%;
}
.center div:nth-child(1)::before,
.center div:nth-child(3)::before
{
    background: linear-gradient(-160deg, #ff0058, #673ab7);
    transform: scaleX(0);
}
.center div:nth-child(2)::before,
.center div:nth-child(4)::before
{
    background: linear-gradient(-20deg, #ff0058, #38009c);
    transform: scaleX(0);   
}
.center div:nth-child(1)::before
{
    animation: animate 1s linear forwards;
    transform-origin: right;
    animation-delay12s;
}
.center div:nth-child(2)::before
{
    animation: animate 1s linear forwards;
    transform-origin: left;
    animation-delay13s;
}
.center div:nth-child(3)::before
{
    animation: animate 1s linear forwards;
    transform-origin: right;
    animation-delay14s;
}
.center div:nth-child(4)::before
{
    animation: animate 1s linear forwards;
    transform-origin: left;
    animation-delay15s;
    width60%;
    left0;
}
@keyframes animate
{
    0%
    {
        transform: scaleX(0);
    }
    100%
    {
        transform: scaleX(1);
    }
}
.center div:nth-child(1)::after,
.center div:nth-child(3)::after
{
    content'';
    position: absolute;
    bottom0;
    left0;
    width100%;
    height50%;
    background: rgba(255,255,255,.2)
}
.center div h2
{
    position: relative;
    margin0;
    padding0;
    z-index10;
    opacity0;
    color: #fff;
}
.center div:nth-child(1h2
{
    animation: fadeText 0.5s linear forwards;
    animation-delay13s;   
    font-size40px;
}
.center div:nth-child(3h2
{
    animation: fadeText 0.5s linear forwards;
    animation-delay15s;   
    font-size90px;
    width800;
}
@keyframes fadeText
{
    0%
    {
        opacity0;
    }
    100%
    {
        opacity1;
    }
}
.loading
{
    position: fixed;
    top0;
    left0;
    width100%;
    height100%;
    background: #fff;
    display: flex;
    justify-content: center;
    align-items: center;
    z-index15;
    animation: fadeout 11s linear forwards;
}
@keyframes fadeout
{
    0%,91%
    {
        opacity1;
        visibility: visible;
    }
    100%
    {
        opacity0;
        visibility: hidden;
    }
}
.loading h2
{
    color: #000;
}
.loading .bar
{
    position: relative;
    width400px;
    height40px;
    background: transparent;
    margin0 20px;
    border2px solid black;
    box-sizing: border-box;
}
.loading .bar::before
{
    content'';
    position: absolute;
    top0;
    left0;
    width100%;
    height100%;
    background: #000;
    transform-origin: left;
    animation: animate 10s linear forwards;
}
.loading .bar::after
{
    content'Loading...';
    position: absolute;
    top0;
    left0;
    width100%;
    height100%;
    font-weight800;
    text-transform: uppercase;
    letter-spacing10px;
    text-align: center;
    line-height36px;
    color: #fff;
    font-size20px;
    mix-blend-mode: difference;
}


Download all files from here:

Downloade Source Code

-By CodeStudio

CodeStudio

Hi, I am Mayur Dehade. I am a Computer Engineering student, Web Developer, Programmer, and also blogger. On this CodeStudio blog, I have uploaded new and interesting coding-related posts and material like notes and provide a full code file.

Post a Comment (0)
Previous Post Next Post