您會取得什麼
- 單一
index.html檔案,內含 Logo 的採樣點陣(最多 1,600 個點)、動畫引擎與樣式。 - 零外部依賴且不發送網路請求,離線亦可直接雙擊在瀏覽器開啟。
- 動畫自動循環:每輪 3.2 秒,成形後停頓 1.2 秒再重新散開演繹。
- 滑鼠經過推開粒子,點擊觸發環形衝擊波。
- HTML 匯出已包含於免費方案中。
1. 匯出檔案
- 開啟工坊。
- 上傳 Logo:點擊選擇 PNG、SVG、JPG 或 WebP 檔案,也可直接拖曳至頁面或按 Ctrl+V / ⌘+V 貼上。透明或純色背景效果最佳;若有缺漏可調整點陣密度與提取閾值。
- 從 16 種效果中任選一款,調整粒子大小、形狀(方塊或圓點)與速度。
- 點擊匯出程式碼,切至 HTML5 單檔 分頁並點選下載檔案(或複製程式碼)。此格式免費版即可使用。
2. 更換效果或調整節奏
打開 index.html,於 <script> 頂端即可見以下設定(範例數值):
const rawPoints = [...]; // your logo's points: [x, y] or [x, y, color]
const defaultColors = [...]; // particle colors, used when a point has no color of its own
const variant = 'condense'; // which effect plays
const baseParticleSize = 1.8; // base particle size, scaled to the card
const particleShape = 'square'; // 'square' or 'circle'
const speedMultiplier = 1; // how fast particles move toward their targets
const duration = 3.2; // seconds per cycle; a 1.2 s hold follows
將 variant 改為下表任一值即可切換效果。粒子尺寸依卡片大小等比縮放:繪製尺寸 = baseParticleSize × 卡片較短邊 ÷ 400,最小 1 px。
| variant 值 | 效果 |
|---|---|
condense | 量子凝聚態 |
mobius-flow | 莫比烏斯拓撲光流 |
vortex | 星系引力坍縮 |
scan | 全息光柵斷層掃描 |
diffusion-denoise | 擴散降噪重構 |
flux-wave | 超導磁通漣漪 |
swarm-assembly | 奈米蜂群智慧組裝 |
gravitational-slingshot | 引力彈弓時間逆流 |
cymatics-resonance | 克拉尼聲波共振 |
curl-flow | 量子旋度流場 |
orbital-sphere | 3D 球面經緯展開 |
matrix-rain | 賽博矩陣數字雨 |
cyber-glitch | 賽博故障切片 |
manhattan-lattice | 正交晶格步進 |
origami-fold | 鏡像摺紙展開 |
helix-weave | 利薩如雙螺旋 |
biolum-pulse | 生物螢光脈動 |
glyph-dissolve | 字元群翼消散 |
3. 嵌入您的網頁
方法一:使用 iframe 嵌入(最簡便且樣式隔離)
將 index.html 上傳至您的網站(例如 /particle-logo/index.html),接著加入:
<iframe src="/particle-logo/index.html" title="Logo 動畫"
width="480" height="520" style="border:0" loading="lazy"></iframe>
該檔案會在黑色頁面中央建立一張最大 480 × 520 px 的卡片並於其中繪製動畫。
方法二:直接將程式碼貼入頁面
複製 .card 元素、.card / canvas / .hint 樣式與 <script>;請勿複製 body 樣式以免覆蓋整頁背景與捲軸。腳本依 id="card" 與 id="canvas" 尋找節點,請保持頁面中 ID 唯一。
Framer、Webflow 與各類建站工具
Pro 提供 Framer / Webflow 專用嵌入碼(framer-webflow-embed.html),會自動填滿容器(高度至少 420 px),直接貼入建站工具的嵌入區塊即可。
4. 效能與無障礙
- 所有粒子繪製於單一 2D Canvas,僅使用一個 requestAnimationFrame 迴圈;背景分頁會自動暫停以節省電量。
- 視窗大小變更時會自動依新尺寸重設畫布。
- 匯出檔未內建檢查系統「減少動態效果」,若有需要可先檢查
matchMedia('(prefers-reduced-motion: reduce)')並改顯靜態 Logo 圖片。
點陣資料(JSON)
點雲 JSON 匯出(Pro 方案)為包含所有採樣點的陣列:
[
{ "x": 132.5, "y": 88, "alpha": 0.8, "color": "rgb(66, 133, 244)" },
{ "x": 136.5, "y": 88, "color": "rgb(66, 133, 244)" }
]
- 座標基於工坊的 400 × 400 採樣畫布。
- 自圖片採樣出的點會附帶
color,半透明點則附帶alpha。 - 程式碼匯出最多保留 1,600 個均勻分佈點位;JSON 匯出則保留全部採樣點。