教學

Tutorial · Claude Code × Scroll Video × Higgsfield MCP

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

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

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

閱讀時間
13 分
更新日期
開啟原始報告
時間
約 30–40 分
難度
中階
工具
Claude Code · GSAP · Higgsfield MCP
一次成品
約 $5–10

01Overview

你會完成什麼

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

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

02Resources to copyPart A

可以直接抄的資源

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

03章節

參考靈感與背後原理

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

CSS 3D Transforms

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

Scroll-Triggered 動畫

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

Scroll-Scrub 影片

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

WebGL / Three.js

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

04章節

技術選型一覽

  • GSAP + ScrollTrigger 必裝 捲動動畫的核心。scrub:true 把動畫綁到捲動條、pin:true 釘住區塊,就是所有 scrollytelling 的基礎。多數情境免費。 https://gsap.com/docs/v3/Plugins/ScrollTrigger/

  • HTML5 <video> 背景 最快加深度感的方法:hero 放一段 loop 影片。關鍵屬性 autoplay muted loop playsinline。

  • Lenis 平滑捲動 加分 讓捲動有「慣性/滑順」感,跟 ScrollTrigger 搭起來質感立刻上一階。 https://github.com/darkroomengineering/lenis

  • Three.js 選用 真 3D/粒子場。Claude Code 可從自然語言 scaffold 出基本場景。 https://threejs.org/

  • Higgsfield MCP 生影片 把 30+ 影片模型(Sora 2、Veo 3.1、Kling 3.0、Seedance 2.0…)接進 Claude Code,用講話生成背景影片。Part B 主角。

05章節

Prompt 範本(可直接複製)

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

PROMPT 1 · 一次把整頁 scaffold 出來 · 複製

text
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 · 交錯淡入的卡片 · 複製

text
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 · 複製

text
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 傾斜 · 複製

text
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.

06章節

GitHub repos & skills

07章節

社群討論與延伸閱讀

08Hands-onPart B

讓 Claude Code 用 Higgsfield MCP 生成影片

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

09章節

前置需求

  • 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 除錯。

101

接上 Higgsfield MCP

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

bash · 安裝(若還沒裝) · 複製

bash
npm install -g @anthropic-ai/claude-code

bash · 註冊 MCP server · 複製

bash
claude mcp add --transport http higgsfield https://mcp.higgsfield.ai/mcp

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

bash · 驗證連線 · 複製

bash
claude mcp list
# higgsfield: https://mcp.higgsfield.ai/mcp - ✓ Connected

112

生成背景影片(Prompt sample)

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

PROMPT · 背景 loop 影片 · 複製

text
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 影片 · 複製

text
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.

壓縮影片再放進網頁

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

bash · FFmpeg 壓縮範例 · 複製

bash
ffmpeg -i hero_raw.mp4 -vf "scale=1920:-2" -c:v libx264 -crf 26 -preset slow -an hero.mp4

123

兩種「捲動影片」做法

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

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

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

html · 背景影片結構 · 複製

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 · 滿版 + 暗化遮罩(讓字看得清) · 複製

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) · 複製

html
<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 · 結構(外層拉高才有捲動距離) · 複製

html
<div class="video-wrap" style="height: 300vh;">
  <video class="scrub-video" muted playsinline preload="auto" src="hero.mp4"></video>
</div>

js · 把 currentTime 綁到捲動 · 複製

js
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 · 影片滿版填滿釘住區 · 複製

css
.scrub-video {
  position: sticky; top: 0;
  width: 100%; height: 100vh;
  object-fit: cover;
}

134

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

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

PROMPT · 組裝整頁 · 複製

text
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.

css · reduced-motion fallback · 複製

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

14章節

驗證它真的會動

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

bash · 複製

bash
npx serve .
# 開 http://localhost:3000

15章節

常見錯誤 & 解法

16章節

下一步

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

建立於 2026-06-12 · 由 tutorial-builder 流程產出 · 設計遵循 Anthropic frontend-design 規範。

主要資料來源:MindStudio、claudefa.st、closingmorecases、Higgsfield 官方部落格、GSAP 官方文件。

參考資料