✨ 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)中使用
- 計算結果僅供參考,請以實際應用場景為準