canvas鼠标跟随彩色粒子发散动画效果代码

代码语言:html

所属分类:粒子

代码描述:canvas鼠标跟随彩色粒子发散动画效果代码

代码标签: canvas 鼠标 跟随 彩色 粒子 发散 动画

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

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

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


  
<style>
body,
html {
  margin: 0;
  padding: 0;
  height: 100%;
  overflow: hidden;
}

#confettiCanvas {
  background-color: #1a202c;
  position: absolute;
  top: 0;
  left: 0;
}

.instruction {
  position: absolute;
  top: 50%;
  left: 50%;
  transform: translate(-50%, -50%);
  color: white;
  font-family: Arial, sans-serif;
  font-size: 24px;
  font-weight: bold;
  text-align: center;
  pointer-events: none;
}
</style>

  
  
</head>

<body translate="no">
  <canvas id="confettiCanvas"></canvas>
<p class="instruction">Move your cursor to create confetti!</p>
  
      <script  >
const canvas = document.getElementById("confettiCanvas");
const ctx = canvas.getContext("2d");
co.........完整代码请登录后点击上方下载按钮下载查看

网友评论0