Charging water drop fusion special effect html+css

Look at the effect first:

Insert picture description here

Foreword:

This idea was made by Steven, the master of UP on station b. I thought it was pretty good, and then I made one myself. (Pure css)

achieve:

  1. Define the label, there are three drop boxes, a circle box displays the number, and a bottom box:
 <div class="kuang">
      <div class="droplet"></div>
      <div class="droplet"></div>
      <div class="droplet"></div>
      <div class="quan"></div>
      <span>99%</span>
   </div>
  1. Give the bottom box a basic style. flex layout, so that the 3 water droplets will temporarily be arranged vertically in the center.
.kuang{
    
    
            position: relative;
            height: 100vh;
            display: flex;
            flex-direction: column;
            justify-content: center;
            align-items: center;
            background-color: rgb(5,5,5);
            filter: contrast(30);
        }

filter: contrast(30); Adjust the contrast of the image. If the value is 0%, the image will be completely black. The value is 100% and the image does not change. The value can exceed 100%, which means that a lower contrast will be used. If no value is set, the default is 1.

  1. The basic style of water droplets. Absolute positioning, so that 3 boxes will overlap.
 .droplet{
    
    
           position: absolute;
            width: 100px;
            height: 100px;
            border-radius: 50%;
            background-color: rgb(61, 233, 99);
            filter: blur(20px);
            animation: fall 3s linear infinite;
            opacity: 0;
        }

filter: blur(20px); Set blur to the image.

Key point: We give the water drop box a fuzzy degree, but the three water drop boxes will appear in a fuzzy state. Then, we set the image contrast to the bottom box, so that the blurred image will redraw the outline, and get the following effect:
Insert picture description here

  1. Give the basic style of the circle to display the number. Remember to also set the ambiguity. In this way, there will be a fusion effect with the falling water droplets under the contrast of the image.
 .quan{
    
    
            position: absolute;
            width: 100px;
            height: 100px;
            border-radius: 50%;
            background-color: rgb(61, 233, 99);
            filter: blur(20px);
            animation: zhuan 3s  infinite;
        }
  1. Animate the water droplets and let them fall from top to bottom, during which the size changes. These can be adjusted slowly by yourself and set to the best effect you think.
 @keyframes fall{
    
    
            0%{
    
    
                opacity: 0;
                transform:  scale(0.8) translateY(-500%);               
            }
            50%{
    
    
                opacity: 1;
                transform: scale(0.5) translateY(-100%) ;
            }
            100%{
    
    
                   transform: scale(0.3) translateY(0px);
            }
        }
  1. Play the animation after the second and third droplets are delayed for a time, so that the three droplets will fall separately. As for a few seconds, you can slowly debug by yourself and set it to the best effect you think.
.kuang div:nth-of-type(2){
    
    
            animation-delay: 1.5s;
        }
        .kuang div:nth-of-type(3){
    
    
            animation-delay: 2s;
        }
  1. Animate the circle that shows the number and make it rotate. During this period, its size or angle can be changed or other changes. The specific value can be adjusted slowly by yourself and set to the best effect you think.
 @keyframes zhuan{
    
    
            0%{
    
    
              transform: scale(1) rotate(0deg);
            }
            50%{
    
    
                transform: scale(1.1) rotate(180deg);
                height: 90px;
                border-top-left-radius: 45%;
                border-bottom-left-radius: 48%;

            }
            100%{
    
    
                transform:scale(1) rotate(360deg);
            }
        }

Complete code:

<!DOCTYPE html>
<html lang="en">
<head>
    <meta charset="UTF-8">
    <meta name="viewport" content="width=device-width, initial-scale=1.0">
    <title>北极光之夜。</title>
    <style>
        *{
     
     
            margin: 0;
            padding: 0;
            box-sizing: border-box;
        }
        .kuang{
     
     
            position: relative;
            height: 100vh;
            display: flex;
            flex-direction: column;
            justify-content: center;
            align-items: center;
            background-color: rgb(5,5,5);
            filter: contrast(30);
        }
        .droplet{
     
     
           position: absolute;
            width: 100px;
            height: 100px;
            border-radius: 50%;
            background-color: rgb(61, 233, 99);
            filter: blur(20px);
            animation: fall 3s linear infinite;
            opacity: 0;
        }
        .kuang div:nth-of-type(2){
     
     
            animation-delay: 1.5s;
        }
        .kuang div:nth-of-type(3){
     
     
            animation-delay: 2s;
        }
        @keyframes fall{
     
     
            0%{
     
     
                opacity: 0;
                transform:  scale(0.8) translateY(-500%);               
            }
            50%{
     
     
                opacity: 1;
                transform: scale(0.5) translateY(-100%) ;
            }
            100%{
     
     
                   transform: scale(0.3) translateY(0px);
            }
        }
        .quan{
     
     
            position: absolute;
            width: 100px;
            height: 100px;
            border-radius: 50%;
            background-color: rgb(61, 233, 99);
            filter: blur(20px);
            animation: zhuan 3s  infinite;
        }
        @keyframes zhuan{
     
     
            0%{
     
     
              transform: scale(1) rotate(0deg);
            }
            50%{
     
     
                transform: scale(1.1) rotate(180deg);
                height: 90px;
                border-top-left-radius: 45%;
                border-bottom-left-radius: 48%;

            }
            100%{
     
     
                transform:scale(1) rotate(360deg);
            }
        }
      span{
     
     
          position: absolute;
          color: rgb(184, 182, 182);
          font-size: 26px;
          font-family: 'fangsong';
          font-weight: bold;
      }
    </style>
</head>
<body>
    <div class="kuang">
      <div class="droplet"></div>
      <div class="droplet"></div>
      <div class="droplet"></div>
      <div class="quan"></div>
      <span>99%</span>
   </div>
</body>
</html>

to sum up:

Insert picture description here
Other articles:
responsive card hovering effect html+css
water wave loading animation html+css
navigation bar scrolling gradient effect html+css+js
, etc...

Guess you like

Origin blog.csdn.net/luo1831251387/article/details/113094589