Velorah — 電影級英雄登陸區塊
來自 MIT 授權的
pulkitxm/claude-directory畫廊的英雄區塊範本。
一個為虛構創意品牌 Velorah 打造的電影級單頁英雄區塊,包含全螢幕循環背景影片、液態玻璃導覽列與 CTA 按鈕(透過自訂 .liquid-glass 毛玻璃效果實現),以及深海軍藍主題下的 Instrument Serif 襯線字體。CSS 關鍵影格的淡入上升入場動畫搭配交錯延遲,創造出精緻的載入顯示效果,使其成為創意代理商、作品集網站與編輯風格登陸頁面的絕佳範本。
工作流程
- 將
example.html複製到使用者的工作區作為工作檔案。 - 將預設內容替換為使用者真實的品牌名稱、標題、正文、數據與圖像。更換素材時,請匹配現有圖像的尺寸。
- 保留設計系統。 下方建構規範中的色板、字體比例、間距節奏與動態效果是此設計的靈魂 — 請勿替換字體、重新調整色板或移除裝飾元素。
- 透過複製區塊來擴展,切勿從其他範本匯入版面。如果缺少某個區塊,請從頭開始,使用此範本的設計語言來創作。
- 確保動畫無障礙。 根據建構規範要求,所有動畫必須受到
prefers-reduced-motion的限制。
輸出合約
在 <artifact> 標籤內輸出:
<artifact identifier="velorah-hero-landing" type="text/html" title="Velorah — 電影級英雄登陸區塊">
<!doctype html>
<html>...</html>
</artifact>
建構規範
以下是產生此設計的上游提示,逐字呈現。
Velorah — 電影級英雄區塊
概述
建立一個單頁英雄區塊,包含全螢幕循環背景影片、毛玻璃(「液態玻璃」)導覽列與行動呼籲按鈕,以及電影風格的襯線字體。版面為極簡風格且垂直居中 — 影片提供所有視覺深度,無需裝飾性形狀、放射漸層或覆蓋層。
技術棧
- 框架: React 18 (
react/react-dom^18.3.1) 搭配 TypeScript (^5.7.3) - 建構工具: Vite (
^5.4.14) 透過@vitejs/plugin-react(^4.3.4) - 樣式: Tailwind CSS (
^3.4.17) 搭配tailwindcss-animate(^1.0.7),autoprefixer(^10.4.20),postcss(^8.5.1) - UI 組件: shadcn/ui (
default樣式,neutral基底色彩,啟用 CSS 變數),基於class-variance-authority(^0.7.1),clsx(^2.1.1), 和tailwind-merge(^2.6.0) - 字體: Instrument Serif (顯示用) 與 Inter 字重 400/500 (內文用),來自 Google Fonts
- 值得注意的技巧: 全螢幕自動播放背景影片、自訂
.liquid-glass毛玻璃效果(背景模糊 + 漸層邊界遮罩),以及帶有交錯延遲的 CSS 關鍵影格淡入上升入場動畫
全域設定
HTML (index.html)
-
<html lang="zh-Hant">(為翻譯而調整,原始為en),<meta charset="UTF-8" />, viewport metawidth=device-width, initial-scale=1.0. -
<meta name="theme-color" content="#002b42" /> -
Meta 描述:
Velorah — 為深度思考者、大膽創造者與沈默叛逆者打造的工具。專注與靈感工作的數位空間。(已翻譯) -
預先連接到
https://fonts.googleapis.com與https://fonts.gstatic.com(後者需加上crossorigin)。 -
透過樣式表連結載入 Google Fonts:
<link href="https://fonts.googleapis.com/css2?family=Instrument+Serif:ital@0;1&family=Inter:wght@400;500&display=swap" rel="stylesheet" /> -
<title>Velorah — 夢想於寂靜中升起</title>(已翻譯) -
頁面主體包含
<div id="root"></div>與<script type="module" src="/src/main.tsx"></script>。
字體
- CSS 變數:
--font-display: 'Instrument Serif', serif;與--font-body: 'Inter', sans-serif;. - 頁面主體使用
font-family: var(--font-body);. - 標題使用行內樣式
fontFamily: "'Instrument Serif', serif"(定義為displayFont常數並重複使用)。 - Tailwind
fontFamily擴展映射display: "var(--font-display)"與body: "var(--font-body)".
進入點 (src/main.tsx)
import { StrictMode } from "react"
import { createRoot } from "react-dom/client"
import App from "./App"
import "./index.css"
createRoot(document.getElementById("root")!).render(
<StrictMode>
<App />
</StrictMode>
)
Vite (vite.config.ts)
使用 @vitejs/plugin-react 與指向 ./src 的 @ 別名:
import path from "node:path"
import react from "@vitejs/plugin-react"
import { defineConfig } from "vite"
export default defineConfig({
plugins: [react()],
resolve: {
alias: {
"@": path.resolve(import.meta.dirname, "./src"),
},
},
})
PostCSS (postcss.config.js)
export default {
plugins: {
tailwindcss: {},
autoprefixer: {},
},
}
色板
深色主題定義為 :root 中 CSS 變數上的 HSL 通道值(在 Tailwind 配置中透過 hsl(var(--token)) 使用):
--background: 201 100% 13%(深海軍藍)--foreground: 0 0% 100%(白色)--muted-foreground: 240 4% 66%(柔和灰)--primary: 0 0% 100%,--primary-foreground: 0 0% 4%--secondary: 0 0% 10%,--secondary-foreground: 0 0% 100%--muted: 0 0% 10%--accent: 0 0% 10%,--accent-foreground: 0 0% 100%--border: 0 0% 18%,--input: 0 0% 18%--ring: 0 0% 100%--radius: 0.5rem
基底層規則:
*套用@apply border-border;.body套用@apply bg-background text-foreground antialiased;加上font-family: var(--font-body);.::selection使用background: hsl(var(--foreground) / 0.92);與color: hsl(var(--background));.
Tailwind 配置 (tailwind.config.ts)
darkMode: ["class"],content: ["./index.html", "./src/**/*.{ts,tsx}"],plugins: [animate](來自tailwindcss-animate)。theme.extend.colors將每個 token 映射到hsl(var(--token)),其中primary,secondary,muted, 與accent各自公開DEFAULT與foreground。theme.extend.borderRadius:lg: "var(--radius)",md: "calc(var(--radius) - 2px)",sm: "calc(var(--radius) - 4px)".
版面 (src/App.tsx)
根容器:relative flex min-h-screen flex-col overflow-hidden bg-background.
影片背景
一個全螢幕的 <video> 元素,放置在根容器內的最前面:
- 類別:
absolute inset-0 z-0 h-full w-full object-cover. - 屬性:
autoPlay,loop,muted,playsInline,加上aria-hidden="true"與tabIndex={-1}以符合無障礙需求。 - 來源(
VIDEO_SRC常數),作為本地素材提供:/assets/hf_20260314_131748_f2ca2a28-fed7-44c8-b9a9-bd9acdd5ec31.mp4.
注意:該素材已在本地
public/assets/目錄下供應。它最初來自一個 CloudFront URL (https://d8j0ntlcm91z4.cloudfront.net/user_38xzzbokvigwjottwixh07lwa1p/hf_20260314_131748_f2ca2a28-fed7-44c8-b9a9-bd9acdd5ec31.mp4);重建時應引用原始碼中使用的本地/assets/...路徑。主機/協議此處已轉為小寫;路徑區段則保留原始來源的檔案名稱。
導覽列 (<header>)
- 容器:
relative z-10 mx-auto flex w-full max-w-7xl flex-row items-center justify-between px-8 py-6. - 標誌: 一個
<a href="/">包含Velorah®,其中®為<sup className="text-xs">®</sup>。類別為text-3xl tracking-tight text-foreground,使用displayFont(Instrument Serif)樣式化,aria-label="Velorah 首頁"。 - 導覽連結: 一個
<nav className="hidden items-center gap-9 md:flex" aria-label="主要導覽">(在行動裝置上隱藏,於md斷點顯示)。- 第一個連結 首頁:
<a href="/">帶有text-sm text-foreground transition-colors與aria-current="page"(活躍狀態)。 - 其餘來自
NAV_LINKS = ["工作室", "關於", "日誌", "聯絡我們"]陣列的連結,每個均渲染為<a>,帶有href={#${label.toLowerCase().replace(/\s+/g, "-")}}與類別text-sm text-muted-foreground transition-colors hover:text-foreground。
- 第一個連結 首頁:
- CTA 按鈕: shadcn
Button,使用variant="glass"與size="pill",標籤為開始旅程,額外套用px-6 py-2.5 text-sm text-foreground hover:scale-[1.03]。
英雄區塊 (<main>)
- 容器:
relative z-10 flex flex-1 flex-col items-center justify-center px-6 pb-40 pt-32 text-center py-[90px]. - 標題 (
<h1>):- 類別:
animate-fade-rise max-w-7xl text-5xl font-normal leading-[0.95] tracking-[-2.46px] sm:text-7xl sm:leading-[0.95] md:text-8xl md:leading-[0.95],使用displayFont(Instrument Serif)樣式化。 - 文字:
夢想於寂靜中升起。— 其中夢想與於寂靜中升起。這兩個部分各自包裹在<em className="not-italic text-muted-foreground">中以獲得色彩對比(直立渲染,柔和灰色)。
- 類別:
- 副文字 (
<p>):- 類別:
animate-fade-rise-delay mt-8 max-w-2xl text-base leading-relaxed text-muted-foreground sm:text-lg. - 文字:
我們為深度思考者、大膽創造者與沈默叛逆者設計工具。在混亂之中,我們打造用於專注與靈感工作的數位空間。
- 類別:
- CTA 按鈕: shadcn
Button,使用variant="glass"與size="pill",標籤為開始旅程,額外套用animate-fade-rise-delay-2 mt-12 cursor-pointer px-14 py-5 text-base text-foreground hover:scale-[1.03]。
App 常數
const VIDEO_SRC =
"/assets/hf_20260314_131748_f2ca2a28-fed7-44c8-b9a9-bd9acdd5ec31.mp4"
const NAV_LINKS = ["工作室", "關於", "日誌", "聯絡我們"]
const displayFont = { fontFamily: "'Instrument Serif', serif" }
按鈕組件 (src/components/ui/button.tsx)
一個使用 class-variance-authority 建構的 shadcn/ui Button,透過 cn 輔助函數轉發引用並合併類別。
- 基礎類別:
inline-flex items-center justify-center gap-2 whitespace-nowrap text-sm font-medium ring-offset-background focus-visible:outline-none focus-visible:ring-2 focus-visible:ring-ring/60 focus-visible:ring-offset-2 focus-visible:ring-offset-background disabled:pointer-events-none disabled:opacity-50. - 變體:
default:bg-primary text-primary-foreground transition-colors hover:bg-primary/90secondary:bg-secondary text-secondary-foreground transition-colors hover:bg-secondary/80ghost:transition-colors hover:bg-accent hover:text-accent-foregroundglass:liquid-glass text-foreground transition-transform duration-300 ease-out will-change-transform
- 尺寸:
default:h-10 rounded-md px-4 py-2sm:h-9 rounded-md px-3lg:h-11 rounded-md px-8pill:rounded-full
- 預設變體:
variant: "default",size: "default".
import * as React from "react"
import { cva, type VariantProps } from "class-variance-authority"
import { cn } from "@/lib/utils"
const buttonVariants = cva(
"inline-flex items-center justify-center gap-2 whitespace-nowrap text-sm font-medium ring-offset-background focus-visible:outline-none focus-visible:ring-2 focus-visible:ring-ring/60 focus-visible:ring-offset-2 focus-visible:ring-offset-background disabled:pointer-events-none disabled:opacity-50",
{
variants: {
variant: {
default:
"bg-primary text-primary-foreground transition-colors hover:bg-primary/90",
secondary:
"bg-secondary text-secondary-foreground transition-colors hover:bg-secondary/80",
ghost:
"transition-colors hover:bg-accent hover:text-accent-foreground",
glass:
"liquid-glass text-foreground transition-transform duration-300 ease-out will-change-transform",
},
size: {
default: "h-10 rounded-md px-4 py-2",
sm: "h-9 rounded-md px-3",
lg: "h-11 rounded-md px-8",
pill: "rounded-full",
},
},
defaultVariants: {
variant: "default",
size: "default",
},
}
)
cn 輔助函數 (src/lib/utils.ts)
import { clsx, type ClassValue } from "clsx"
import { twMerge } from "tailwind-merge"
export function cn(...inputs: ClassValue[]) {
return twMerge(clsx(inputs))
}
液態玻璃效果
自訂的 .liquid-glass 組件類別(在 @layer components 中定義)提供毛玻璃外觀:近乎透明的白色填充搭配亮度混合模式、4px 背景模糊、內部高光陰影,以及透過遮罩的 ::before 偽元素呈現的漸層「邊界」。
.liquid-glass {
background: rgba(255, 255, 255, 0.01);
background-blend-mode: luminosity;
backdrop-filter: blur(4px);
-webkit-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;
}
動畫效果
基於關鍵影格的淡入上升入場動畫(在 @layer utilities 中定義),每個動畫執行 0.8s ease-out,使用 both 填充模式與交錯延遲。在 prefers-reduced-motion: reduce 設定下禁用動畫。
@keyframes fade-rise {
from { opacity: 0; transform: translateY(24px); }
to { opacity: 1; transform: translateY(0); }
}
.animate-fade-rise { animation: fade-rise 0.8s ease-out both; }
.animate-fade-rise-delay { animation: fade-rise 0.8s ease-out 0.2s both; }
.animate-fade-rise-delay-2 { animation: fade-rise 0.8s ease-out 0.4s both; }
@media (prefers-reduced-motion: reduce) {
.animate-fade-rise,
.animate-fade-rise-delay,
.animate-fade-rise-delay-2 {
animation: none;
}
}
應用方式:
- 頁面標題 (
<h1>) 套用animate-fade-rise。 - 副文字 (
<p>) 套用animate-fade-rise-delay。 - 英雄區塊的 CTA 按鈕套用
animate-fade-rise-delay-2。