Scanning Effect

Home / Web Code Snippet / Scanning Effect

Scanning Effect


https://youtube.com/shorts/nmvxT4evAWU?si=njMCFvN_7rT_i858

HTML CODE:-

<!DOCTYPE html>
<html>
<head>
    <meta charset="utf-8">
    <meta name="viewport" content="width=device-width, initial-scale=1">
    <title></title>
</head>
<body>
<div class="container">
    <div class="scan"></div>
    <h2>Scanning......</h2>
</div>
</body>
</html>

CSS CODE:-

       body{
            padding: 0px;
            margin: 0px;
            display: flex;
            align-items: center;
            justify-content: center;
            min-height: 100vh;
            background: black;
        }
        .container{
            position: relative;
            display: flex;
            flex-direction: column;
            align-items: center;
        }
        .scan{
            position: relative;
            width: 250px;
            height: 250px;
            background: url("img/he1.png");
            background-repeat: no-repeat;
            background-size: 250px;
        }
        .scan::before{
            content: "";
            position: absolute;
            top: 0;
            left: 0;
            width: 100%;
            height: 100%;
            background: url("img/he2.png");
            animation: animate 4s ease-in-out infinite;
            background-repeat: no-repeat;
            background-size: 250px;
            filter: drop-shadow(0 0 10px red);
        }
        @keyframes animate{
            0%{
                height: 0%;
            }
            50%{
                height: 100%;
            }
            100%{
                height: 0%;
            }
        }
        .scan::after{
            content: "";
            position: absolute;
            top: 0;
            left: 0;
            width: 100%;
            height: 5px;
            background: #fa4d4d;
            border-radius: 5px;
            filter: drop-shadow(0 0 20px #fa4d4d) drop-shadow(0 0 80px #fa4d4d);
            animation: animate1 4s ease-in-out infinite;
        }
        @keyframes animate1{
            0%{
                top: 0%;
            }
            50%{
                top: 100%;
            }
            100%{
                top: 0%;
            }
        }
        h2{
            color: #fa4d4d;
            filter: drop-shadow(0 0 20px #fa4d4d);
            animation: animate2 1s steps(1) infinite;
        }
        @keyframes animate2{
            0%{
                opacity: 0;
            }
            50%{
                opacity: 1;
            }
            100%{
                opacity: 0;
            }
        }