p5实现按钮点击粒子泡泡喷射动画效果代码

代码语言:html

所属分类:粒子

代码描述:p5实现按钮点击粒子泡泡喷射动画效果代码

代码标签: p5 按钮 点击 粒子 泡泡 喷射 动画

下面为部分代码预览,完整代码请点击下载或在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.01.css">
<style>
@import url("https://fonts.googleapis.com/css2?family=Itim&display=swap");
* {
  margin: 0;
  padding: 0;
}

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

.btn {
  width: 140px;
  height: 140px;
  border-radius: 100%;
  background: #fc2aac;
  z-index: 100;
  cursor: pointer;
  transition: 0.4s ease;
}
.btn p {
  color: white;
  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 #fc2aac;
}
.btn:active {
  transform: scale(0.9);
  box-shadow: -2px 2px 23px #fc2aac;
}

particle {
  position: absolute;
  background: #fc2aac;
  left: 0;
  border-radius: 100%;
  pointer-events: none;
  top: 0;
  transform-style: preserve-3d;
  opacity: 0;
  z-index: 5;
}
</style>


  
  
</head>

<body>
  <div class="btn flex justify-center items-center">
    <p>CLICK ME</p>
</div>
<script type="text/javascript" src="//repo.bfw.wiki/bfwrepo/js/p5.1.6.0.js"></script>
      <script >
console.clear();
let am = 60;

let btn = document.querySelector(".btn");
let btnEl = document.querySelector(".btn").getBoundingClientRect();
let xCenter = (btnEl.left + btnEl.right) / 2;
let yCenter = (btnEl.top + btnEl.bottom) / 2;


window.addEventListener('resize', function(event) {  
	 btn = document.querySelector(".btn");
	 btnEl.........完整代码请登录后点击上方下载按钮下载查看

网友评论0