svg试管冒泡动画效果

代码语言:html

所属分类:动画

代码描述:试管冒泡动画效果,通过svg结合js实现

代码标签: 动画 效果

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

<!DOCTYPE html>
<html lang="en">
<head>
<meta charset="UTF-8">

<style>
:root {
  --primary: #a231ff;
  --primary-dark: #6a22d6;
  --grey-light: #F5F6FA;
  --grey: #645c6b;
  --white: #ffffff;
}

*, *::before, *::after {
  margin: 0;
  padding: 0;
  box-sizing: inherit;
}

html {
  box-sizing: border-box;
  font-size: 62.5%;
  overflow-y: scroll;
}

.container {
  min-height: 100vh;
  display: flex;
  justify-content: center;
  align-items: center;
  background: var(--grey-light);
}

.test-tube {
  display: flex;
  flex-direction: column;
  justify-content: center;
  align-items: center;
}

.line-top {
  height: .6rem;
  width: 10rem;
  margin-bottom: -.6rem;
  background: var(--grey);
  z-index: 500;
  position: relative;
}
.line-top::before, .line-top::after {
  content: '';
  position: absolute;
  height: .6rem;
  width: 1.4rem;
  background: var(--grey);
  top: 2.4rem;
  border-radius: 1rem;
}
.line-top::before {
  left: -.4rem;
}
.line-top::after {
  left: 9rem;
}
.line-top__line1, .line-top__line2 {
  position: absolute;
  top: 12rem;
  left: 1.8rem;
  height: 10rem;
  width: .6rem;
  background: var(--white);
  opacity: .5;
  border-radius: 1rem;
}
.line-top__line2 {
  top: 10rem;
  height: 1.5rem;
}

.top {
  width: 14.2rem;
  height: 3rem;
  margin-bottom: -.7rem;
  border-radius: 4rem;
  border: 0.6rem solid var(--grey);
  z-index: 100;
}

.liquid {
  width: 7.8rem;
  height: 20rem;
  margin-bottom: -24.7rem;
  margin-top: 4.8rem;
  display: flex;
  flex-direction: column;
  justify-content: center;
  align-items: center;
  position: relative;
  z-index: 300;
}
.liquid__bottom {
  height: 18rem;
  width: inherit;
  border-bottom-left-radius: 8rem;
  border-bottom-right-radius: 8rem;
  background: var(--primary);
  background: linear-gradient(360deg, var(--primary-dark) 0%, var(--primary) 100%);
}

.tube {
  width: 10.2rem;
  height: 25.8rem;
  border-bottom-left-radius: 8rem;
  border-bottom-right-radius: 8rem;
  .........完整代码请登录后点击上方下载按钮下载查看

网友评论0