NHM 古生物學 — 自然史博物館單色著陸頁
從 MIT 授權的
pulkitxm/claude-directory圖庫中取得的著陸頁。
一個單色、編輯風格的著陸頁,專為虛構的自然史博物館古生物學收藏設計,包含三部分連續滾動:一個全視口英雄區,具有延遲背景影片揭示和動畫幾何「NHM」SVG 標誌(每個多邊形滑入揭示);一個「探索我們的世界」區塊,包含滾動揭示的顯示標題和行動膠囊;以及一個深色「古代收藏」章節瀏覽器,具有自動循環化石圖像和自訂 SVG feTurbulence/feDisplacementMap 沙塵溶解轉場效果。使用 React 19、Vite 6、Tailwind CSS 4(CSS-first 設定)和 Motion (Framer Motion) 建構,嚴格採用黑/白/灰的單色調色板 — 無色彩強調。
工作流程
- 將
example.html複製 到使用者的工作區作為工作檔案。 - 取代佔位內容,使用使用者的真實品牌名稱、標題、正文、數字和圖像。更換資產時,請比對現有圖像尺寸。
- 保留設計系統。 下方建構規格中的調色板、字體比例、間距節奏和動畫是識別標誌 — 請勿更換字體、重新著色調色板或移除裝飾元素。
- 透過複製區塊來擴展,切勿從其他範本匯入版面。如果缺少某個區塊,請使用此範本自身的語彙從頭開始設計。
- 保持動畫無障礙。 根據建構規格要求,每個動畫必須遵循
prefers-reduced-motion。
輸出合約
在 <artifact> 標籤之間輸出:
<artifact identifier="nhm-paleontology-landing" type="text/html" title="NHM 古生物學 — 自然史博物館單色著陸頁">
<!doctype html>
<html>...</html>
</artifact>
建構規格
產生此設計的上游提示,逐字保留。
NHM — 自然史博物館古生物學著陸頁
概述
為自然史博物館的古生物學收藏建立一個單頁、單色調的著陸頁。頁面是連續滾動,包含三個區塊 — 一個全視口英雄區,具有延遲背景影片和幾何「NHM」標誌;一個「探索我們的世界」介紹區塊;以及一個深色「古代收藏」章節瀏覽器,具有 SVG 濾鏡沙塵/溶解圖像轉場。整個頁面是一個單一的 App.tsx 元件,加上同檔案中的 SandTransitionImage 輔助元件和 LeafIcon 輔助元件。
技術棧
- 框架: React 19 (
react,react-dom^19.0.1) 搭配StrictMode - 建構工具: Vite 6 (
vite^6.2.3,@vitejs/plugin-react^5.0.4) - 語言: TypeScript (
typescript~5.8.2,@types/react^19.0.10,@types/react-dom^19.0.4) - 樣式: Tailwind CSS 4 (
tailwindcss^4.1.14,@tailwindcss/vite^4.1.14) — 透過@theme進行 CSS-first 設定 - 動畫: Motion / Framer Motion (
motion^12.23.24),從motion/react匯入 - 圖示: Lucide (
lucide-react^0.546.0) - 字體 (Google Fonts): Inter (無襯線,字重 300/400/500/600) 和 JetBrains Mono (等寬,字重 400/500)
- 顯著技術: 延遲背景影片揭示、自動循環章節輪播、由
requestAnimationFrame驅動的 SVGfeTurbulence/feDisplacementMap沙塵溶解濾鏡、每個多邊形動畫的幾何多邊形標誌、whileInView滾動揭示。
全域設定
index.html
lang="en",<meta charset="UTF-8" />,viewport metawidth=device-width, initial-scale=1.0。- Description meta:
NHM — Natural History Museum. Exploring the story of life on earth through science, discovery and wonder. - Title:
NHM — Natural History Museum - Root:
<div id="root"></div>和<script type="module" src="/src/main.tsx"></script>。
src/main.tsx
import { StrictMode } from "react";
import { createRoot } from "react-dom/client";
import "./index.css";
import App from "./App";
createRoot(document.getElementById("root")!).render(
<StrictMode>
<App />
</StrictMode>,
);
src/index.css
@import url('https://fonts.googleapis.com/css2?family=Inter:wght@300;400;500;600&family=JetBrains+Mono:wght@400;500&display=swap');
@import "tailwindcss";
@theme {
--font-sans: "Inter", ui-sans-serif, system-ui, sans-serif;
--font-mono: "JetBrains Mono", ui-monospace, SFMono-Regular, monospace;
}
@layer base {
body {
background-color: #fcfcfc;
color: #111;
overflow-x: hidden;
font-family: var(--font-sans);
-webkit-font-smoothing: antialiased;
}
::selection {
background-color: #000;
color: #fff;
}
}
@layer utilities {
.text-mega {
font-size: 21vw;
line-height: 0.75;
letter-spacing: -0.04em;
}
}
全域樣式摘要: 背景 #fcfcfc,文字 #111,選取範圍 #000 背景 / #fff 文字,overflow-x: hidden,預設字體 font-sans (Inter),抗鋸齒。定義了 .text-mega 工具類別(font-size: 21vw,line-height: 0.75,letter-spacing: -0.04em),但並非每個版面都需要。
資料、狀態與常數
匯入
import { useEffect, useRef, useState } from "react";
import { AnimatePresence, motion, usePresence } from "motion/react";
import type { Variants } from "motion/react";
import {
ArrowRight,
ArrowUpRight,
Bone,
BookOpen,
Dna,
Gem,
Leaf,
Plus,
} from "lucide-react";
資源 URL (本地,存放於 /assets/ 目錄下)
注意:資源是從本地
/assets/...提供,而非遠端 CDN。原始簡報參考了 Cloudinary URL;此專案將它們存放在本地,並使用這些確切(小寫、區分大小寫)的檔名。
const VIDEO_URL =
"/assets/magnific_use-img-2-as-the-exact-ba_Piu3X0W42C_wnrc8f.mp4";
const PTERODACTYL_URL =
"/assets/ChatGPT_Image_May_23_2026_12_24_44_PM_1_lv1dne.png";
章節資料
const chaptersData = [
{ name: "恐龍時代", image: "/assets/01_udnber.png" },
{ name: "古生物化石", image: "/assets/02_pmvxxl.png" },
{ name: "中生代爬行動物", image: "/assets/03_hcp3jc.png" },
{ name: "海洋化石畫廊", image: "/assets/04_get63z.png" },
{ name: "史前巨獸", image: "/assets/05_kz1tyu.png" },
];
其他常數
const NAV_LINKS = ["參觀", "展覽", "探索", "學習", "關於"];
const ACTION_PILLS = [
{ icon: Bone, label: "恐龍" },
{ icon: Dna, label: "古生命" },
{ icon: Gem, label: "礦物" },
{ icon: Leaf, label: "化石" },
{ icon: BookOpen, label: "了解更多" },
];
const EASE: [number, number, number, number] = [0.16, 1, 0.3, 1];
元件狀態(在 App 內部)
const [showVideo, setShowVideo] = useState(false);
const [activeChapter, setActiveChapter] = useState(2); // 從「中生代爬行動物」開始
const [isMobileMenuOpen, setIsMobileMenuOpen] = useState(false);
showVideo在 2800ms 的setTimeout後切換為true(在卸載時清除)。activeChapter每 3500ms 透過setInterval自動循環,包裝(prev + 1) % 5(在卸載時清除)。
動畫變體
const fadeUp: Variants = {
initial: { opacity: 0, y: 20 },
animate: { opacity: 1, y: 0 },
};
const fadeUpTransition = { duration: 0.8, ease: "easeOut" as const };
const letterBlock: Variants = {
initial: { y: 120, opacity: 0 },
animate: {
y: 0,
opacity: 1,
transition: { duration: 1.2, ease: EASE },
},
};
const logoVariants: Variants = {
initial: { scale: 1.03 },
animate: {
scale: 1,
transition: {
duration: 1.2,
ease: EASE,
staggerChildren: 0.06,
delayChildren: 0.1,
},
},
};
const staggerHeader: Variants = {
animate: { transition: { staggerChildren: 0.1, delayChildren: 0.1 } },
};
const staggerLeft: Variants = {
animate: { transition: { staggerChildren: 0.15, delayChildren: 0.6 } },
};
const staggerRight: Variants = {
animate: { transition: { staggerChildren: 0.15, delayChildren: 0.9 } },
};
const staggerPills: Variants = {
animate: { transition: { staggerChildren: 0.1, delayChildren: 0.3 } },
};
版面
根元素:<main className="w-full"> 包含三個 <section> 區塊。
區塊 1 — 英雄區(全視口高度)
容器:relative flex min-h-screen w-full flex-col overflow-hidden
1D. 背景影片
首先渲染(位於所有元素後方),由 AnimatePresence 內部的 showVideo 控制。
- 包裝
motion.div:initial={{ opacity: 0 }},animate={{ opacity: 1 }},transition={{ duration: 1.4, ease: "easeOut" }},類別pointer-events-none absolute top-0 left-0 z-0 h-full w-full。 <video>:autoPlay loop muted playsInline,src={VIDEO_URL},類別h-full w-full object-cover。
1A. 頁首 — NHM 標誌
motion.header 搭配 initial="initial" animate="animate" variants={staggerHeader},類別 relative z-20 px-6 pt-6 md:px-16。
motion.h1使用variants={logoVariants},類別w-full。包含一個<span className="sr-only">NHM — Natural History Museum</span>以及內嵌 SVG。- SVG:
viewBox="0 0 840 100",類別w-full overflow-hidden fill-[#111],aria-hidden="true"。 - 字母由
LOGO_LETTERS資料驅動;每個字母是一個<g transform={letter.translate}>,每個多邊形是一個motion.polygon,搭配variants={letterBlock}(從y: 120滑入)。
const LOGO_LETTERS: { translate: string; polygons: string[] }[] = [
{
// N
translate: "translate(0,0)",
polygons: [
"0,0 14,0 14,100 0,100",
"200,0 214,0 214,100 200,100",
"0,0 33,0 214,100 181,100",
],
},
{
// H
translate: "translate(280,0)",
polygons: [
"0,0 14,0 14,100 0,100",
"200,0 214,0 214,100 200,100",
"14,43 200,43 200,57 14,57",
],
},
{
// M
translate: "translate(560,0)",
polygons: [
"0,0 14,0 14,100 0,100",
"266,0 280,0 280,100 266,100",
"0,0 26,0 153,100 127,100",
"254,0 280,0 153,100 127,100",
],
},
];
1B. 子導航列
motion.div 搭配 variants={fadeUp} transition={fadeUpTransition},類別 mt-8 flex items-start justify-between gap-3 font-mono text-[10px] tracking-[0.2em] uppercase md:text-[11px]。
- 左欄(
w-[15%]):三個<p>行 —Natura/History/Museum。 - 箭頭分隔線(
hidden w-[5%] justify-center md:flex):LucideArrowRight,size={14},strokeWidth={1},類別text-gray-400。 - 中間欄(
flex-1 leading-relaxed font-mono text-gray-800 md:flex-none md:w-[30%]):文案 "Exploring the story of life on earth through science, discovery and wonder." 在桌機上分為 3 行(hidden md:block),在手機上分為 4 行(md:hidden):- 桌機:
Exploring the story of life/on earth through science,/discovery and wonder. - 手機:
Exploring the story/of life on earth/through science,/discovery and wonder.
- 桌機:
- 箭頭分隔線(同上,
hidden w-[5%] justify-center md:flex)。 - 右欄 / 導航(
hidden w-[15%] md:block):<ul className="space-y-1 text-gray-800">映射NAV_LINKS— Visit, Exhibitions, Discover, Learn, About — 每個都是<a href="#">,類別transition-colors hover:text-black hover:underline。 - 漢堡選單按鈕(最右側,
md:hidden):<button type="button">,aria-label在Open menu/Close menu之間切換,aria-expanded={isMobileMenuOpen},onClick切換isMobileMenuOpen,類別group z-60 flex flex-col items-end gap-[6px] py-2 pl-4 md:hidden。- 兩個
<span>條,每個基礎類別h-[1.5px] bg-black transition-all duration-300。 - 開啟時:第一個條
w-8 translate-y-[3.75px] rotate-45;第二個條w-8 -translate-y-[3.75px] -rotate-45(形成 X 形狀)。 - 關閉時:第一個條
w-8 group-hover:w-6;第二個條w-8 group-hover:w-10。
- 兩個
1C. 手機選單覆蓋層
AnimatePresence 包裝一個 motion.div,在 isMobileMenuOpen 為 true 時顯示。
initial={{ y: -20, opacity: 0 }},animate={{ y: 0, opacity: 1 }},exit={{ y: -20, opacity: 0 }},transition={{ duration: 0.4, ease: EASE }}。- 類別:
absolute top-full right-0 left-0 z-50 border-b border-gray-200 bg-[#fcfcfc] shadow-xl md:hidden。 <nav className="px-6 py-10">搭配<ul className="space-y-6 font-mono text-sm tracking-[0.2em] uppercase">映射相同的NAV_LINKS;每個連結的onClick關閉選單(setIsMobileMenuOpen(false)),類別transition-colors hover:text-black hover:underline。
英雄區主體包裝
<div className="relative z-10 flex w-full flex-1 items-start justify-between"> 包含左側和右側邊欄。
1E. 左側邊欄內容
motion.div 搭配 initial="initial" animate="animate" variants={staggerLeft},類別 mt-20 w-[320px] px-10 sm:mt-28 md:mt-32 md:px-16。
- 區塊指示器(
motion.div variants={fadeUp},類別flex items-center gap-4 font-mono text-xs):<span>01</span>+<span className="h-[1.5px] w-16 bg-black/20" />。 - 標題(
motion.h2 variants={fadeUp},類別mt-6 text-[3.5rem] leading-[1] font-normal tracking-tight md:text-[5rem]):TIMELESS<br />WONDERS。 - 描述(
motion.p variants={fadeUp},類別mt-6 w-[240px] text-[13px] leading-[1.6] text-gray-700 md:text-[14px]):Step into the natural world and/discover the stories written/millions of years ago.(每個短語之間有換行)。 - 行動呼籲按鈕(
motion.div variants={fadeUp},類別mt-10):一個<button type="button">,類別group relative overflow-hidden rounded-md border border-[#1a1a1a] bg-[#1a1a1a] px-6 py-3.5 shadow-sm transition-all duration-300 hover:-translate-y-[0.5px] hover:shadow-[3px_3px_0px_rgba(17,17,17,0.5)] active:translate-y-0 active:shadow-sm。- 滑動背景面板(
<span aria-hidden="true">):`absolute inset-0 -translate-x-[101%] bg-[#fcfcfc] transition-transform duration-700 ease-[cubic-bezier(0.16,1,0.3
- 滑動背景面板(