上面是效果
代码展示
index.html
<!doctype html> <html> <head> <meta charset="utf-8"> <title></title> <style> html, body { position: absolute; overflow: hidden; margin: 0; padding: 0; width: 100%; height: 100%; background:#000; touch-action: none; content-zooming: none; } canvas { position: absolute; width: 100%; height: 100%; background:#000; }</style> </head> <body> <canvas></canvas> <script> "use strict"; { // particles class class Particle { constructor(k, i, j) { this.i = i; this.j = j; this.init(); this.x = this.x0; this.y = this.y0; this.pos = posArray.subarray(k * 3, k * 3 + 3); this.pointer = pointer; } init() { this.x0 =