Verly制作一个流体粒子效果

代码语言:html

所属分类:粒子

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

<!DOCTYPE html>
<html lang="en">
<head>
<meta charset="UTF-8">
<title>Verly Fluid Particles</title>
<style>
      body {
  font-family: 'Segoe UI', Tahoma, Geneva, Verdana, sans-serif;
  overflow: hidden;
}

a {
  color: #006eff;
  position: absolute;
  top: 20px;
  left: 20px;
  font-size: 12px;
  background-color: white;
  padding: 8px;
  border-radius: 5px;
  font-weight: bold;
}
    </style>

</head>
<body translate="no">
<canvas id="c"></canvas>
<a target="__blank" href="https://github.com/anuraghazra/Verly.js">Made with Verly.js</a>

<script src='http://repo.bfw.wiki/bfwrepo/js/verly.js'></script>
<script>
      let canvas = document.getElementById("c");
let ctx = canvas.getContext("2d");
let width = window.innerWidth;
let height = window.innerHeight;
canvas.width = width;
canvas.height = height;

let NUM_PARTICLES = 700;
if (width > 1200) NUM_PARTICLES = 1000;

let verly = new Verly(16, canvas, ctx);
let mouse = new Point(0, 0).setForceAcc(-30).setRadius(100);

let mBehavior = 2;
window..........完整代码请登录后点击上方下载按钮下载查看

网友评论0