Tutorial · Claude Code × Scroll Video × Higgsfield MCP

做出會 捲動播放影片 與 3D 動態的高質感網站

這份教程拆成兩段:先給你一整包「可以直接抄」的 Prompt、GitHub repo、技能與社群資源;再手把手帶你把 Higgsfield.ai 的 MCP 接進 Claude Code,讓它能直接生成背景影片,並做出隨捲動播放(scroll-scrub)的影片效果。

約 30–40 分 🎚 難度 中階 🧰 Claude Code · GSAP · Higgsfield MCP 💸 一次成品 約 $5–10

Overview你會完成什麼

你在 YouTube 上看到的那種「滑一下整個畫面就動起來、有影片背景、有 3D」的網站,幾乎都是同一套配方堆出來的:Claude Code 寫前端AI 生成的影片素材GSAP ScrollTrigger 驅動捲動動畫。你參考的影片〈Claude Fable 5 Changed Web Design Forever〉示範的正是這條路線。

跟著這份教程走完,你會得到三樣東西:一份能直接貼進 Claude Code 的 Prompt 清單;一個已經接上 Higgsfield、能用講話的方式生成影片的 Claude Code;以及一個會隨著捲動播放影片的網頁範本。

◆ 我做了哪些假設

輸出是這份繁體中文的 HTML 教學(單一檔案、符合 frontend-design 設計規範);假設你已經會基本操作 Claude Code,目標是「複製出類似效果」。程式碼與指令都用英文,方便你直接貼上執行。若想調整方向,告訴我即可。


Part A

Resources to copy可以直接抄的資源

先別急著寫程式。把下面這四類資源備好——原理、技術選型、Prompt、現成 repo——你之後給 Claude Code 的每一句話都會更準。

參考靈感與背後原理

「捲動影片/3D 網站」其實是好幾種技術的統稱,複雜度差很多。先分清楚你要的是哪一種,才不會殺雞用牛刀:

CSS 3D Transforms

卡片 hover 傾斜、區塊隨捲動旋轉。用 perspective / transform,不需任何框架。最便宜、CP 值最高。

Scroll-Triggered 動畫

元素隨捲動淡入、釘住(pin)、依序觸發。業界標準是 GSAP ScrollTrigger。這是「活起來」的關鍵。

Scroll-Scrub 影片

影片不自動播,而是跟著捲動條一格一格前進(Apple 產品頁那種)。本教程 Part B 會實作。

WebGL / Three.js

真正的 3D:粒子、幾何體、shader。效果最強但成本最高,手機效能要特別顧。

◆ 經驗法則

對多數 landing page,CSS 3D + GSAP 就能拿到 80% 的視覺效果,只花 20% 的力氣。Three.js 留給你真的需要 3D 幾何的時候再用。

技術選型一覽

  • GSAP + ScrollTrigger 必裝
    捲動動畫的核心。scrub:true 把動畫綁到捲動條、pin:true 釘住區塊,就是所有 scrollytelling 的基礎。多數情境免費。
  • HTML5 <video> 背景
    最快加深度感的方法:hero 放一段 loop 影片。關鍵屬性 autoplay muted loop playsinline
  • Lenis 平滑捲動 加分
    讓捲動有「慣性/滑順」感,跟 ScrollTrigger 搭起來質感立刻上一階。
  • Three.js 選用
    真 3D/粒子場。Claude Code 可從自然語言 scaffold 出基本場景。
  • Higgsfield MCP 生影片
    把 30+ 影片模型(Sora 2、Veo 3.1、Kling 3.0、Seedance 2.0…)接進 Claude Code,用講話生成背景影片。Part B 主角。

Prompt 範本(可直接複製)

這幾條是整套流程最常用的 Prompt。給 Claude Code 的建站 Prompt 用英文最穩,照著改名稱與風格即可。

PROMPT 1 · 一次把整頁 scaffold 出來

Create a single-page landing page for a product called "Vela". Hero: full-bleed looping video background (file: hero.mp4) with a centered headline + subheadline and a dark overlay for legibility. Then a scroll-triggered section where three feature cards fade in and slide up 40px, staggered 0.15s. Then a pinned "scrollytelling" section (300vh) where a hero video scrubs frame-by-frame as the user scrolls, driven by GSAP ScrollTrigger. Then a horizontal-scroll product timeline. Style: dark, cinematic, premium — near-black background, warm off-white text, one accent color. Plain HTML/CSS/JS, load GSAP + ScrollTrigger via CDN. Add a prefers-reduced-motion fallback and make it fully responsive. Plan the architecture first, then build.

PROMPT 2 · 交錯淡入的卡片

When the features section scrolls into view, animate each card: fade in and slide up from 40px below its final position, staggered 0.15s apart. Trigger when the top of the section hits 80% of the viewport height. Use GSAP ScrollTrigger.

PROMPT 3 · 釘住式 scrollytelling

Pin the demo section for a scroll distance of 300vh. As the user scrolls through it, sequence three beats evenly: (1) the dashboard mockup fades in, (2) a highlight ring appears on the key metric, (3) a results card slides in from the right. Use ScrollTrigger pin + scrub.

PROMPT 4 · 滑鼠追蹤 3D 傾斜

Add a mouse-tracking 3D tilt to the feature cards: tilt toward the cursor up to 15° on both axes, with a subtle specular highlight that follows the cursor. Use CSS perspective + a small JS handler. Disable it on touch devices.

◆ 最被低估的一招

在每個建站 Prompt 結尾加上 Plan the architecture first, then build.。讓 Claude Code 先規劃再動工,能在「變成一大坨難拆的程式碼」之前先抓出架構問題。

GitHub repos & skills

社群討論與延伸閱讀


Part B

Hands-on讓 Claude Code 用 Higgsfield MCP 生成影片

這段把三件事一次做完:把 Higgsfield MCP 接上 Claude Code、用一句話生成背景影片、再把影片做成隨捲動播放的效果。最後附上可直接抄的 Prompt。

前置需求

  • Claude Code 已安裝
    npm install -g @anthropic-ai/claude-code(macOS 也可 brew install anthropic-claude-code)。
  • 一個 Higgsfield 帳號
    higgsfield.ai 註冊,免費額度即可開始,註冊不需信用卡。
  • 本機 dev server 與瀏覽器
    npx serve 或 VS Code Live Server 都行;用 DevTools 除錯。
1

接上 Higgsfield MCP

一行指令把 Higgsfield 的 MCP server 用 HTTP 註冊進 Claude Code,之後不需 API key、不需寫任何 glue code。

bash · 安裝(若還沒裝)
npm install -g @anthropic-ai/claude-code
bash · 註冊 MCP server
claude mcp add --transport http higgsfield https://mcp.higgsfield.ai/mcp

第一次叫用 Higgsfield 工具時,Claude 會印出一個 OAuth 授權網址:在瀏覽器打開 → 用你的 Higgsfield 帳號登入授權 → 把授權碼貼回終端機。Token 會跨 session 保存,這是一次性設定。

bash · 驗證連線
claude mcp list
# higgsfield: https://mcp.higgsfield.ai/mcp - ✓ Connected
✓ 預期結果
higgsfield: https://mcp.higgsfield.ai/mcp - ✓ Connected
⚠ 沒看到綠勾?

最常見原因是 OAuth 那頁還沒貼授權碼就關掉了。重跑一次 claude mcp add …,再重做一次授權即可。企業版帳號可能要管理員先把 mcp.higgsfield.ai 加進白名單。

2

生成背景影片(Prompt sample)

先有影片、再寫程式——因為影片的色調會決定整頁的配色與排版。直接在 Claude Code 裡用講的就好。

PROMPT · 背景 loop 影片

Generate a 6-second seamless looping background video: slow-moving dark teal and violet fluid geometry, cinematic depth of field, high-contrast near-black background, no text, no faces, photorealistic lighting, 16:9. Use Seedance 2.0 fast. Then give me the download URL.

PROMPT · scroll-scrub 用的 hero 影片

Generate an 8-second cinematic clip for a scroll-scrubbed hero: a single sports car slowly rotating 360° on a dark reflective floor, volumetric light, locked camera, 16:9, no text. Use Kling 3.0. Keep the motion smooth and continuous from start to end so it scrubs cleanly with GSAP ScrollTrigger.

◆ 背景影片的四個原則

動作要慢(別搶走文字注意力)、底色要深(白底影片上的字很難讀)、要能無縫 loop長度 4–8 秒就夠。預設先用 Seedance 2.0 fast(純文字、約 30 秒出片、支援 9:16 / 16:9 / 1:1)。

⚠ 兩個實務雷點

Pro 方案同時最多 3 個 job,批次請分三個一組丟。若回傳 ip_detected(模型以為你引用了受保護內容),改寫一下重送即可——被擋的 job 不會扣點數。

壓縮影片再放進網頁

大影片會拖垮效能。用 HandBrakeFFmpeg 轉成 MP4 並壓到 5MB 以下(1080p loop 通常不需要更大)。順手也輸出一份 .webm

bash · FFmpeg 壓縮範例
ffmpeg -i hero_raw.mp4 -vf "scale=1920:-2" -c:v libx264 -crf 26 -preset slow -an hero.mp4
3

兩種「捲動影片」做法

你要的效果有兩種實作路線。做法 A 是自動播放的背景影片;做法 B 是隨捲動條一格一格走的 scroll-scrub。多數網站兩者都會用到。

做法 A · 自動播放的全螢幕背景影片

最簡單、相容性最好。重點屬性:autoplaymuted(現代瀏覽器自動播放的必要條件)、loopplaysinline(iOS 必要)。

html · 背景影片結構
<section class="hero">
  <video class="hero-video" autoplay muted loop playsinline
         preload="auto" poster="hero-poster.jpg">
    <source src="hero.mp4" type="video/mp4">
    <source src="hero.webm" type="video/webm">
  </video>
  <div class="hero-content">
    <h1>Your Headline</h1>
  </div>
</section>
css · 滿版 + 暗化遮罩(讓字看得清)
.hero { position: relative; overflow: hidden; }
.hero-video {
  position: absolute; inset: 0;
  width: 100%; height: 100%;
  object-fit: cover; z-index: 0;
}
.hero::after {              /* 暗化遮罩,依影片亮度調整 */
  content: ''; position: absolute; inset: 0;
  background: rgba(0, 0, 20, 0.55); z-index: 1;
}
.hero-content { position: relative; z-index: 2; }

做法 B · 隨捲動播放的 scroll-scrub 影片

這是 Apple 產品頁那種效果:影片不自動播,而是把 video.currentTime 綁到捲動進度。先載入 GSAP 與 ScrollTrigger:

html · 載入 GSAP(CDN)
<script src="https://cdnjs.cloudflare.com/ajax/libs/gsap/3.12.5/gsap.min.js"></script>
<script src="https://cdnjs.cloudflare.com/ajax/libs/gsap/3.12.5/ScrollTrigger.min.js"></script>
html · 結構(外層拉高才有捲動距離)
<div class="video-wrap" style="height: 300vh;">
  <video class="scrub-video" muted playsinline preload="auto" src="hero.mp4"></video>
</div>
js · 把 currentTime 綁到捲動
gsap.registerPlugin(ScrollTrigger);

const video = document.querySelector(".scrub-video");

// 等 metadata 載入才拿得到 video.duration
video.addEventListener("loadedmetadata", () => {
  const tl = gsap.timeline({
    scrollTrigger: {
      trigger: ".video-wrap",
      start: "top top",
      end: "bottom bottom",
      scrub: true,     // 動畫跟著捲動條走
      pin: true        // 捲動期間把影片釘在畫面
    }
  });
  tl.fromTo(video, { currentTime: 0 }, { currentTime: video.duration });
});
css · 影片滿版填滿釘住區
.scrub-video {
  position: sticky; top: 0;
  width: 100%; height: 100vh;
  object-fit: cover;
}
◆ 讓捲動更順

scrub: true 換成 scrub: 0.5 會多 0.5 秒「追上」捲動,慣性感更滑。再搭 Lenis 平滑捲動更佳。行動裝置上 scrub 影片較吃力,可考慮改用 canvas 影格序列或在手機改放靜態圖。

4

串起整套(一句話交給 Claude Code)

把上面拆解的東西交回給 Claude Code 一次組裝。先把生成好的 hero.mp4 放進專案資料夾,再下這個 Prompt。

PROMPT · 組裝整頁

I've added hero.mp4 to the project. Build index.html + styles.css + main.js: 1) A hero with a full-bleed autoplay/muted/loop/playsinline video background + dark overlay + centered headline. 2) Right after the hero, a pinned 300vh section that scroll-scrubs hero.mp4 frame-by-frame using GSAP ScrollTrigger (bind video.currentTime to scroll, scrub: 0.5). 3) A features section with three cards that fade in + slide up, staggered 0.15s. Load GSAP + ScrollTrigger via CDN. Add a prefers-reduced-motion fallback that hides the video and shows hero-poster.jpg. Make it fully responsive and test on mobile widths. Plan first, then build.

◆ 別忘了無障礙

有不少使用者開了「減少動態效果」。務必加上 prefers-reduced-motion 的 fallback:

css · reduced-motion fallback
@media (prefers-reduced-motion: reduce) {
  .hero-video, .scrub-video { display: none; }
  .hero {
    background-image: url("hero-poster.jpg");
    background-size: cover;
  }
}

驗證它真的會動

起一個本機伺服器,逐項確認:

bash
npx serve .
# 開 http://localhost:3000
✓ 應該看到
1. Hero 影片自動播放、loop、靜音,字在影片上清楚可讀
2. 往下捲時,pinned 區的影片「跟著捲動」一格格前進(非自動播)
3. 三張卡片在進入視窗時依序淡入、上移
4. 開系統「減少動態效果」後重整 → 影片改成靜態海報圖

常見錯誤 & 解法

⚠ 手機上影片不自動播

確認 mutedplaysinline 都有;部分舊版 Android 還需要 preload="auto"

⚠ scrub 影片完全不動

多半是還沒拿到 video.duration 就建了 timeline。把 timeline 包在 loadedmetadata 事件裡(如做法 B 的程式碼)。

⚠ 卡片一進頁面就全播完了

ScrollTrigger 沒註冊或 start 值不對。確認有 gsap.registerPlugin(ScrollTrigger),並把 start 設成像 "top 80%"

⚠ 捲動時畫面卡頓(jank)

給動畫元素加 will-change: transform, opacity,並把背景影片壓到 5MB 以下。

claude mcp list 沒有綠勾

重做 OAuth(最常見是沒貼授權碼就關頁)。仍不行就 claude mcp remove higgsfield 後重加。

下一步

想再往上一層,可以:用 Soul Character 訓練固定角色/產品,讓多支影片視覺一致;把 hero 影片換成 canvas 影格序列(把影片拆成 PNG 序列逐格繪製)以換取更順的 scrub 與行動裝置相容性;或加一層 Three.js 粒子場疊在影片之上。每加一個效果,都先在手機上實測效能再決定保留。

◆ 一句總結

配方就是:Higgsfield 生影片 → 壓縮 → Claude Code 用 GSAP ScrollTrigger 組裝 → 手機實測。先規劃再建,先深色慢動作,先把無障礙顧好,質感就穩了。