div+css实现上下浮动漂浮的肥皂泡泡水泡动画效果代码

代码语言:html

所属分类:布局界面

代码描述:div+css实现上下浮动漂浮的肥皂泡泡水泡动画效果代码

代码标签: div css 上下 浮动 漂浮 肥皂 泡泡 水泡 动画

下面为部分代码预览,完整代码请点击下载或在bfwstudio webide中打开

<!DOCTYPE html>
<html lang="zh-CN">

<head>

  <meta charset="UTF-8">
  <meta name="viewport" content="width=device-width, initial-scale=1.0, user-scalable=no">
<style>
    * {
  margin: 0;
  padding: 0;
  box-sizing: border-box;
  /* 解决手机浏览器点击有选框的问题 */
  -webkit-tap-highlight-color: rgba(0, 0, 0, 0);
}
body {
  display: flex;
  justify-content: center;
  align-items: center;

  min-height: 100vh;
  background-color: #000000;
}

.bubble {
  position: absolute;

  width: 200px;
  height: 200px;
  border-radius: 50%;
  box-shadow: inset 0 0 25px rgba(255, 255, 255, 0.25);

  animation: animate 8s ease-in-out infinite;
}
.bubble:nth-child(2) {
  position: relative;

  zoom: 0.45;
  top: -100px;
  left: -10px;

  animation-delay: -4s;
}
.bubble:nth-child(3) {
  position: relative;

  zoom: 0.25;
  top: -300px;
  right: -80px;

  animation-delay: -6s;
}
.bubble:nth-child(4) {
  position: relative;

  zoom: 0.35;
  bottom: -200px;
  right: -120px;

  animation-delay: -3s;
}
.bubble:nth-child(5) {
  position: relative;

  zoom: 0.5;
  top: -250px;
  left: 0;

  animation-delay: -5s;
}

@keyframes animate {
  0%,
  100% {
    transform: translateY(-20px);
  }
  50% {
    transform: translateY(20px);
  }
}

.bubble::before {
  content: "";
  position: absolute;
  top: 50px;
  left: 45px;

  width: 30px;
  height: 30px;
  border-radius: 50%;
  background-color: #ffffff;
  filter: blur(2px);

  z-index: 10;
}
.bubble::after {
  content: "";
  position: absolute;
  top: 80px;
  left: 85px;

  width: 20px;
  height: 20px;
  border-radius: 50%;
  background-color: #ffffff;
  filter: bl.........完整代码请登录后点击上方下载按钮下载查看

网友评论0