Particle Logo

在 Astro 中加入 Logo 粒子動畫

Astro 預設零 JS 輸出,可搭配 client:visible 進入視口再水合,或把免費匯出的 HTML 單檔放進 public/ 目錄。

更新於

方案一:透過 client:visible 按需水合(Pro)

若 Astro 專案已整合 @astrojs/react 或 @astrojs/vue,可匯入 PixelLogoLoader 並加上 client:visible,捲動至可視範圍才啟動繪製:

---
import { PixelLogoLoader } from '../components/PixelLogoLoader';
---

<!-- Hydrate only when scrolled into view -->
<PixelLogoLoader client:visible variant="condense" height={340} />

方案二:零前端框架依賴(免費版適用)

匯出免費 HTML5 單檔存入 public/logo-loader.html 並以延遲載入的 iframe 嵌入:

<!-- Zero-JS Astro option using the free HTML5 export in public/logo-loader.html -->
<iframe
  src="/logo-loader.html"
  title="Brand particle logo"
  style="width:100%;height:420px;border:0;border-radius:16px;background:#000;"
  loading="lazy"
></iframe>

修改 variant 即可切換 16 種效果。

進入工坊

其他教學