js实现canvas可修改参数彩色粒子粉尘跟随鼠标绽放代码

代码语言:html

所属分类:粒子

代码描述:js实现canvas可修改参数彩色粒子粉尘跟随鼠标绽放代码

代码标签: js canvas 修改 参数 彩色 粒子 粉尘 跟随 鼠标 绽放 代码

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

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

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

  
  
<style>
* {
  box-sizing: border-box;
  margin: 0;
  padding: 0;
}

body {
  background: #07060d;
  overflow: hidden;
  cursor: none;
  width: 100vw;
  height: 100vh;
}

#c {
  display: block;
  width: 100%;
  height: 100%;
  position: fixed;
  top: 0;
  left: 0;
}

#toggle {
  position: fixed;
  top: 12px;
  right: 12px;
  width: 28px;
  height: 28px;
  border-radius: 50%;
  background: rgba(8, 7, 18, 0.82);
  border: 0.5px solid rgba(255, 255, 255, 0.2);
  cursor: pointer;
  display: flex;
  align-items: center;
  justify-content: center;
  z-index: 20;
  font-size: 13px;
  color: rgba(255, 255, 255, 0.7);
  line-height: 1;
  transition: background 0.12s, border-color 0.12s;
}

#toggle:hover {
  background: rgba(40, 35, 60, 0.95);
  border-color: rgba(255, 255, 255, 0.45);
}

.panel {
  position: fixed;
  top: 48px;
  right: 12px;
  width: 260px;
  background: rgba(8, 7, 18, 0.9);
  border: 0.5px solid rgba(255, 255, 255, 0.1);
  border-radius: 10px;
  font-family: monospace;
  font-size: 11px;
  color: rgba(255, 255, 255, 0.7);
  overflow: hidden;
  cursor: default;
  transition: opacity 0.15s, transform 0.15s;
  transform-origin: top right;
  z-index: 19;
}

.panel.hidden {
  opacity: 0;
  pointer-events: none;
  transform: scale(0.94);
}

.phead {
  padding: 8px 12px 7px;
  border-bottom: 0.5px solid rgba(255, 255, 255, 0.07);
}

.phead span {
  font-size: 10px;
  letter-spacing: 0.1em;
  color: rgba(255, 255, 255, 0.25);
  text-transform: uppercase;
}

.pbody {
  padding: 10px 12px 12px;
  width: 100%;
}

.row {
  display: flex;
  align-items: center;
  margin-bottom: 7px;
  gap: 4px;
  width: 100%;
}

.row label {
  flex-shrink: 0;
  width: 78px;
  color: rgba(255, 255, 255, 0.4);
  font-size: 10px;
}

.row input[type=range] {
  flex: 1;
  min-width: 0;
  height: 2px;
  accent-color: #7b8fff;
  cursor: pointer;
}

.row .val {
  flex-shrink: 0;
  width: 32px;
  text-align: right;
  color: rgba(255, 255, 255, 0.82);
  font-size: 10px;
}

.row select {
  flex: 1;
  min-width: 0;
  background: rgba(255, 255, 255, 0.06);
  border: 0.5px solid rgba(255, 255, 255, 0.13);
  border-radius: 4px;
  color: rgba(255, 255, 255, 0.78);
  font-family: monospace;
  font-size: 10px;
  padding: 2px 4px;
  cursor: pointer;
}

.sep {
  border: none;
  border-top: 0.5px solid rgba(255, 255, 255, 0.07);
  margin: 7px 0;
}

#btnChaos {
  width: 100%;
  margin-top: 8px;
  border-radius: 5px;
.........完整代码请登录后点击上方下载按钮下载查看

网友评论0