svg+js实现按钮点击水滴液体分离动画效果代码

代码语言:html

所属分类:动画

代码描述:svg+js实现按钮点击水滴液体分离动画效果代码

代码标签: svg js 按钮 点击 水滴 液体 分离 动画

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

<!DOCTYPE html>
<html lang="en" >

<head>
  <meta charset="UTF-8">
  


<link type="text/css" rel="stylesheet" href="//repo.bfw.wiki/bfwrepo/css/tailwind.2.2.7.css">
  
<style>
@import url("https://fonts.googleapis.com/css2?family=Itim&display=swap");
* {
  margin: 0;
  padding: 0;
}

body {
  background: #bb4278;
  width: 100%;
  height: 100vh;
  overflow: hidden;
  display: flex;
  justify-content: center;
  align-items: center;
  font-family: "Itim", cursive;
  filter: url("#goo");
}

.btn {
  width: 140px;
  height: 140px;
  border-radius: 100%;
  background: #80ece9;
  z-index: 100;
  cursor: pointer;
  transition: 0.4s ease;
  filter: url("#goo");
}
.btn p {
  color: #913b72;
  font-size: 22px;
  line-height: 1;
  -webkit-user-select: none;
  /* Safari */
  -ms-user-select: none;
  /* IE 10 and IE 11 */
  user-select: none;
  /* Standard syntax */
}
.btn:hover {
  box-shadow: 0px 1px 9px #80ece9;
}
.btn:active {
  transform: scale(0.9);
  box-shadow: -2px 2px 23px #80ece9;
}

particle {
  position: absolute;
  background: #80ece9;
  left: 0;
  border-radius: 100%;
  pointer-events: none;
  top: 0;
  transform-style: preserve-3d;
  opacity: 0;
  z-index: 5;
  filter: url("#goo");
}

svg {
  position: absolute;
  top: -100%;
  left: -100%;
}
</style>


  
  
</head>

<body translate="no">
  <div class="btn flex justify-center items-center">
    <p>CLICK ME</p>
</div>

<svg xmlns="http://www.w3.org/2000/svg" version="1.1">
    <defs>
        <filter id="goo">
            <feGaussianBlur in="SourceGraphic" stdDeviation="10" result="blur" />
            <feColorMatrix in="blur" mode="matrix" values="1 0 0 0 0  0 1 0 0 0  0 0 1 0 0  0 0 0 18 -7" result="goo" />
            <feBlend in="SourceGraphic" in2="goo" />
        </filter>
    </defs>
</svg>
  
      &.........完整代码请登录后点击上方下载按钮下载查看

网友评论0