Cinematic Landing 模板
適用於高級登陸頁面的規範性模板,帶有 scroll-scrub canvas hero。靈感來自 Apple AirPods Pro、Stripe、Sony Bravia。
強制技術棧(請勿更換)
npm create vite@latest . -- --template react-ts
npm install
npm install -D tailwindcss@next @tailwindcss/vite @tailwindcss/postcss autoprefixer
npm install motion lucide-react
npm install @fontsource/{display-font} @fontsource/{body-font}
npx shadcn@latest init -d
npx shadcn@latest add button accordion
檔案結構
src/
App.tsx
main.tsx
index.css # 設計 token + Tailwind @theme + liquid-glass 工具類
components/
ScrubSequence.tsx # canvas 幀渲染器(關鍵)
BlurText.tsx # 單詞交錯標題(關鍵)
Navbar.tsx # 浮動 liquid-glass 藥丸
Hero.tsx # scroll-scrub canvas + 標題 + CTA
ServicesBento.tsx # 6 卡不對稱 bento
Pourquoi.tsx # 4 欄 why-us 網格
Process.tsx # 3-4 步驟編號水平流程
Stats.tsx # 影片背景 + 4 個帶計數動畫的統計數據
Testimonials.tsx # 2 行相反方向的跑馬燈
Faq.tsx # 2 欄佈局(sticky 標題 + 手風琴)
CtaFooter.tsx # 電影級影片背景 + CTA + 底部欄
ui/
button.tsx # 包含 hero、heroGlass、heroSolid 變體
accordion.tsx
lib/
utils.ts
constants.ts # FRAME_COUNT、FRAMES_PATH、FRAME_EXT
public/
frames/ # frame_0001.jpg ... frame_NNNN.jpg
9 個區塊 — 強制模式
1. Navbar(浮動 liquid-glass 藥丸)
fixed top-4 left-1/2 -translate-x-1/2 z-50,帶有liquid-glass rounded-full px-2 py-2- 3 個區域:logo+brand(左)| 導航連結置中(md+)| CTA(右)
- 滾動 > 40px:
top-4 → top-2+backdrop-blur-xl - 手機版:漢堡選單 + 全屏 liquid-glass sheet
2. Hero(scroll-scrub canvas)
<section ref={scrollRef} className="relative h-[250vh]">(250vh 為幀序列提供滾動空間)<div className="sticky top-0 h-screen overflow-hidden">用於固定- Canvas 絕對定位 inset-0 z-0
- 徑向漸層暗角 z-1
- 指向下一區塊的底部淡出 z-2
- 內容(徽章 + BlurText H1 + 副標題 + CTA + 合作夥伴跑馬燈)z-10
3. ServicesBento(不對稱 6 卡)
- 網格
md:grid-cols-3 gap-5 - 卡 0:高
row-span-2 - 卡 1-2:小
- 卡 3:寬
col-span-2 - 卡 4:小
- 卡 5:全寬
col-span-3 - 每張卡:
liquid-glass rounded-2xl+ 圖示使用liquid-glass-strong rounded-full size-11+ display heading + 38ch 內文 + 右上角 ArrowUpRight
4. Pourquoi(4 欄 why-us)
- 網格
lg:grid-cols-4 gap-5 mt-16 - 每張卡:liquid-glass + 圖示 + display 標題 + 30ch 內文 + 底部強調線
5. Process(編號水平流程)
md:grid-cols-4 gap-0(gap-0 因為連接器填滿間隙)- 巨大數字
text-[140px] text-primary/25重疊 - 水平連接器:
absolute top-20 -right-0 h-px w-full bg-gradient-to-r from-border via-border to-transparent
6. Stats(影片背景 + 計數動畫)
- 影片背景
filter saturate(0)降低飽和度 - 頂部和底部 200px 漸層淡出
- 中央卡片 liquid-glass
rounded-3xl p-14 - 4 個統計數據:數值
font-display italic text-7xl+ 標籤uppercase tracking-wide text-sm - 當進入視口時,使用 motion 從 0 開始動畫計數
7. Testimonials(2 行跑馬燈)
- 第 1 行:
animate-[marquee_28s_linear_infinite] - 第 2 行:
animate-[marquee-rev_32s_linear_infinite](相反方向) - 遮罩:
[mask-image:linear-gradient(to_right,transparent,black_8%,black_92%,transparent)] - 懸停暫停:
hover:[animation-play-state:paused]
8. FAQ(2 欄佈局)
- 網格
md:grid-cols-[0.9fr_1.1fr] gap-16 - 左側:sticky
md:sticky md:top-24,包含徽章 + display heading + 段落 + 按鈕 - 右側:shadcn Accordion,項目已設定樣式
9. CTA + Footer
- 影片背景
filter brightness(0.55)(此處不使用 saturate-0,與 Stats 區別) - 標題
font-display italic text-[180px](此處不使用 uppercase — italic 是另一種風格) - Footer:border-top + 版權 + footer 連結
設計 Token(index.css)
@import "@fontsource/{display-font}/400.css";
@import "@fontsource/{display-font}/700.css";
@import "@fontsource/{body-font}/400.css";
@import "tailwindcss";
:root {
/* 原始調色盤 HSL 三元組(不使用 hsl() 包裝以在 Tailwind 中支援 alpha) */
--ink: 20 15% 9%;
--cream: 40 30% 90%;
--ochre: 32 55% 65%;
--terra: 14 55% 31%;
/* 語意 */
--background: var(--ink);
--foreground: var(--cream);
--primary: var(--ochre);
--secondary: var(--terra);
--muted: 240 4% 16%;
--muted-foreground: 40 6% 72%;
--border: 40 30% 90% / 0.18;
--ring: var(--ochre);
--radius: 0.75rem;
/* 排版 */
--font-display: "Oswald", "Impact", sans-serif;
--font-body: "Inter", -apple-system, sans-serif;
/* 佈局 */
--gutter: clamp(20px, 4.2vw, 56px);
--max: 1440px;
}
@theme {
--color-background: hsl(var(--background));
--color-foreground: hsl(var(--foreground));
--color-primary: hsl(var(--primary));
/* ... 其餘語意 token */
--animate-marquee: marquee 28s linear infinite;
--animate-marquee-rev: marquee-rev 32s linear infinite;
}
@keyframes marquee { from { transform: translateX(0) } to { transform: translateX(-50%) } }
@keyframes marquee-rev { from { transform: translateX(-50%) } to { transform: translateX(0) } }
Liquid-glass 工具類(@layer components)
.liquid-glass {
background: rgba(255,255,255,0.01);
background-blend-mode: luminosity;
backdrop-filter: blur(4px);
border: none;
box-shadow: inset 0 1px 1px rgba(255,255,255,0.1);
position: relative;
overflow: hidden;
}
.liquid-glass::before {
content: '';
position: absolute;
inset: 0;
border-radius: inherit;
padding: 1.4px;
background: linear-gradient(180deg,
rgba(255,255,255,0.45) 0%, rgba(255,255,255,0.15) 20%,
rgba(255,255,255,0) 40%, rgba(255,255,255,0) 60%,
rgba(255,255,255,0.15) 80%, rgba(255,255,255,0.45) 100%);
-webkit-mask: linear-gradient(#fff 0 0) content-box, linear-gradient(#fff 0 0);
-webkit-mask-composite: xor;
mask-composite: exclude;
pointer-events: none;
}
.liquid-glass-strong { /* 同上但 blur(50px) + 更強 box-shadow */ }
動畫 — 5 個原語(請勿發明新的)
- BlurText(標題):單詞交錯 0.07 秒,每個單詞持續時間 0.7 秒,緩動函數
[0.22, 1, 0.36, 1] - Fade-up-on-view(副標題、CTA):
initial={{opacity:0, y:16, filter:"blur(8px)"}},whileInView={{opacity:1, y:0, filter:"blur(0)"}},viewport={{once:true, amount:0.3}} - Scroll-scrub canvas(僅 hero):Apple AirPods Pro 模式。參見技能
scroll-scrub-canvas。 - Marquee(合作夥伴、推薦):28 秒/32 秒相反方向,漸層遮罩邊緣,懸停暫停
- Liquid-glass
::beforeborder(卡片、藥丸、按鈕):切勿替換為常規 CSS border
反廢料防護規則(15 條 — 提交前請閱讀)
- 任何地方都不得使用 emoji(文案、卡片、按鈕均不可)
- 不得使用紫/粉預設漸層(調色盤為暖色:ochre + terra + cream + ink)
- 卡片不得使用
shadow-2xl(深度 = backdrop blur,無投影) - 按鈕不要用
rounded-3xl→ 按鈕用rounded-full,卡片用rounded-2xl - 不得留下
lorem ipsum佔位符(使用[TODO: {{PLACEHOLDER}}]標記) - 正文段落不要用
text-center(hero 和 CTA 除外 — 它們是獨立區域) - 標題:
font-display uppercase tracking-tight或font-display italic(同一元素上不可兩者同時使用) - 每個區塊:徽章 + 標題 + 副標題模式(hero 和 footer 除外)
- 僅使用
lucide-react圖示(不使用 heroicons、Material 或自訂 SVG,除非使用者提供) - hero 不要用
<video>— hero 是 canvas。<video>僅用於 Stats 和 CTA 背景。 - 不要用
motion.div搭配transition={{ duration: > 0.9 }} - 不要有 console.log、註解掉的程式碼、空檔案或未使用的 import
- 文案使用
{{LANG}}— 不要自動翻譯佔位符 - 響應式:1440 桌面版 canvas,375px 手機版(iPhone SE),無水平滾動
- 無障礙設計:focus-visible:ring-2 ring-ring offset-2 offset-background,canvas aria-hidden,sr-only siblings 描述影片
交付前驗證
npm run dev # 啟動無報錯
npm run build # 0 個 TS 錯誤,0 個 Vite 錯誤
# 視覺檢查:
# - Hero 首次繪製 < 300ms(優先預加載 frame_0001)
# - Scrub 無卡頓 > 50ms
# - Marquee 循環無縫(複製陣列,中點不可見)
# - FAQ 手風琴高度變化流暢
# - Navbar 在滾動 > 40px 時從 top-4 變為 top-2
# - 375px 無水平溢出
# 控制台:
# - 0 個 React 警告
# - 0 個幀 URL 404 錯誤
# 效能:
# - Lighthouse 效能 ≥ 85
# - LCP < 2.5s(使用 <link rel="preload"> 預加載 frame_0001)
幀提取管線
mkdir -p input public/frames
ffmpeg -i input/source.mp4 \
-vf "fps=30,scale='min(1920,iw)':'-2':flags=lanczos" \
-q:v 3 \
public/frames/frame_%04d.jpg
ls public/frames | wc -l # 貼上到 FRAME_COUNT
可選的 WebP(約小 40%):
for f in public/frames/*.jpg; do
cwebp -q 82 "$f" -o "${f%.jpg}.webp" && rm "$f"
done
如果總容量 > 20MB 且部署在 Vercel hobby 方案(25 MB 限制):發出警告並建議使用外部 CDN。
資源
- ScrubSequence 元件:參見技能
scroll-scrub-canvas - 動畫原理:技能
emilkowalski-skill - 高級元件:技能
magic-mcp-21st - Tailwind v4 文檔:https://tailwindcss.com/docs/v4-beta
- shadcn/ui:https://ui.shadcn.com
- Framer Motion (motion.dev):技能
motion