Bubble Background Animation

Home / Web Code Snippet / Bubble Background Animation

Bubble Background Animation


https://youtube.com/shorts/afL98WZpV2M?si=Gq2FLOuPXO69SU13

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">
      <h1>Saksham Digital</h1>
        <span></span>
        <span></span>
        <span></span>
        <span></span>
        <span></span>
        <span></span>
        <span></span>
        <span></span>
        <span></span>
        <span></span>
        <span></span>
        <span></span>
        <span></span>
        <span></span>
        <span></span>
   </div>
</body>
</html>

CSS CODE:-

    body{
        padding: 0px;
        margin: 0px;
        box-sizing: border-box;
        background: black;
        overflow: hidden;
    }
    .container{
        position: relative;
        width: 100%;
        min-height: 100vh;
        display: flex;
        align-items: center;
        justify-content: center;
    }
    .container h1{
          color: white;
          font-size: 40px;
          font-weight: 800;
          text-transform: uppercase;
    }
    .container span{
          height: 50px;
          width: 50px;
          border: 2px solid rgba(255,255,255,0.25);
          border-radius: 50px;
          position: absolute;
          top: 10%;
          left: 10%;
          animation: 4s linear infinite;
    }
    .container span::before{
        content: "";
          height: 10px;
          width: 10px;
          border-radius: 50px;
          background: white;
          position: absolute;
          top: 20%;
          right: 20%;
    }
    .container span:nth-child(1) {
          top: 20%;
          left: 20%;
          animation: animate 7s linear infinite;
    }
    .container span:nth-child(2) {
          top: 60%;
          left: 80%;
          animation: animate 10s linear infinite;
    }
    .container span:nth-child(3) {
          top: 40%;
          left: 40%;
          animation: animate 4s linear infinite;
    }
    .container span:nth-child(4) {
          top: 66%;
          left: 30%;
          animation: animate 7s linear infinite;
    }
    .container span:nth-child(5) {
          top: 90%;
          left: 10%;
          animation: animate 9s linear infinite;
    }
    .container span:nth-child(6) {
          top: 30%;
          left: 60%;
          animation: animate 5s linear infinite;
    }
    .container span:nth-child(7) {
          top: 70%;
          left: 20%;
          animation: animate 8s linear infinite;
    }
    .container span:nth-child(8) {
          top: 75%;
          left: 60%;
          animation: animate 10s linear infinite;
    }
    .container span:nth-child(9) {
          top: 50%;
          left: 50%;
          animation: animate 6s linear infinite;
    }
    .container span:nth-child(10) {
          top: 45%;
          left: 20%;
          animation: animate 10s linear infinite;
    }
    .container span:nth-child(11) {
          top: 10%;
          left: 90%;
          animation: animate 9s linear infinite;
    }
    .container span:nth-child(12) {
          top: 20%;
          left: 70%;
          animation: animate 7s linear infinite;
    }
    .container span:nth-child(13) {
          top: 20%;
          left: 20%;
          animation: animate 8s linear infinite;
    }
    .container span:nth-child(14) {
          top: 60%;
          left: 5%;
          animation: animate 6s linear infinite;
    }
    .container span:nth-child(15) {
          top: 90%;
          left: 80%;
          animation: animate 9s linear infinite;
    }
    @keyframes animate{
          0%{
            transform: scale(0) translateY(0) rotate(80deg);
          }
          100%{
            transform: scale(1.2) translateY(-100px) rotate(360deg);
          }
    }