粒子效果能量特效
代码语言:html
所属分类:粒子
下面为部分代码预览,完整代码请点击下载或在bfwstudio webide中打开
<!DOCTYPE html> <html lang="en"> <head> <meta charset="UTF-8"> <title> Energy</title> <style> html, body { margin: 0; padding: 0; height: 100%; } body { background-color: #000; display: flex; align-items: center; justify-content: center; overflow: hidden; } canvas { flex-shrink: 0; background-color: #222; image-rendering: -moz-crisp-edges; image-rendering: -webkit-crisp-edges; image-rendering: pixelated; object-fit: contain; } </style> </head> <body translate="no"> <script> // UTIL const PI = Math.PI, TWO_PI = Math.PI * 2; const Util = {}; Util.timeStamp = function () { return window.performance.now(); }; Util.random = function (min, max) { return min + Math.random() * (max - min); }; Util.map = function (a, b, c, d, e) { return (a - b) / (c - b) * (e - d) + d; }; Util.lerp = function (value1, value2, amount) { return value1 + (value2 - value1) * amount; }; Util.clamp = function (value, min, max) { return Math.max(min, Math.min(max, value)); }; // Vector class Vector { constructor(x, y) { this.x = x || 0; this.y = y || 0; } set(x, y) { this.x = x; this.y = y; } reset() { this.x = 0; this.y = 0; } fromAngle(angle) { let x = Math.cos(angle), y = Math.sin.........完整代码请登录后点击上方下载按钮下载查看
网友评论0