✨ Interactive Canvas Particle System
A real-time Canvas particle system with multiple emitters, mouse interaction and presets, with every parameter adjustable live.
📐 计算公式 / 原理
粒子初始化:速度分量 = (random − 0.5) × 速度 × 2;尺寸 = 基准尺寸 × (0.5 + random × 0.5);寿命 = 基准寿命 × (0.7 + random × 0.3)(勾选“无限寿命”时记 −1;否则由秒数换算为 60fps 帧数);角度 = random × 2π,角速度 = (random − 0.5) × 0.02。更新:vy 每帧加 重力 × 0.1;鼠标交互在 120 px 内按 (120 − 距离) ÷ 120 × 0.8 施力做吸引或排斥;速度每帧乘 0.99 阻尼;寿命递减到 0 移除,越出 ±50 px 边界时有寿粒子移除、无限寿粒子从对侧回绕。绘制:不透明度 = 剩余寿命 ÷ 初始寿命(无限寿命取 1),发光模糊 = 尺寸 × 2;连线仅当粒子数 < 300 时生效,线透明度 = (1 − 距离 ÷ 连线距离) × 0.4
基于 Canvas 的实时粒子系统:支持多种发射模式与鼠标交互,参数实时调整即时生效;用于动态背景与视觉特效。
⚙️ 基础参数
🎨 颜色设置
🚀 发射模式
🖱️ 鼠标交互
吸引模式
✨ 预设效果
📚 深度解析:粒子特效生成器
💡 常见使用场景
- 活动页背景。
- 落地页氛围。
- 参数化粒子预览与效果试验。
生成上浮粒子
❓ 常见问题(FAQ)
- 移动端卡吗?
- 粒子越多越耗性能,移动端建议降低数量与频率。
- 能导出图片吗?
- 本工具只复制/下载参数 JSON,不导出当前帧 PNG 或成品动画代码;成品效果需自行实现。
- 会保存或上传我的内容吗?
- 结果以浏览器实时计算为准,纯前端本地处理、数据不上传;生成的样式与代码仅作快速产出参考,正式项目请以设计系统、规范与浏览器实测为准。
Formula & Standard References
| Item | Formula / Note | Source / Standard |
|---|---|---|
| Motion integration | update with p += v x dt and v += a x dt each frame | Numerical integration practice |
| Frame-rate independence | scale by real elapsed time so high refresh rates stay consistent | Animation timing practice |
| Performance budget | cost grows linearly with particle count, keep it low on mobile | Rendering practice |
⚠️ 使用说明与注意事项
- 本工具纯前端运行,数据不会上传到服务器
- 建议在主流浏览器(Chrome/Safari/Firefox/Edge)中使用
- 计算结果仅供参考,请以实际应用场景为准