Astra — 電影級太空旅行登陸頁面
登陸頁面來自 MIT 授權的
pulkitxm/claude-directory圖庫。
一個為「astra」打造的單頁太空旅行登陸頁面,包含兩個全高區塊——英雄區域與能力展示區——兩者皆疊加在循環播放的背景影片上,透過自訂的 rAF 驅動 JavaScript 程式碼(無 CSS 過渡效果)進行交叉淡入。頁面為所有鍍鉻元素(導航欄、標籤、卡片、行動呼籲按鈕)共享一套「液態玻璃」設計系統;所有文字均為白色,顯示在滿版影片之上且無深色疊加層,對比度完全來自玻璃鍍鉻。
工作流程
- 將
example.html複製到使用者的工作區作為工作檔案。 - 取代佔位內容為使用者真實的品牌名稱、標題、內文、數字和圖像。更換素材時請比對現有圖片尺寸。
- 保留設計系統。 下方建置規範中的色板、字體階層、間距節奏和動態效果即為品牌識別——請勿替換字體、重新配色或移除裝飾元素。
- 透過複製區塊來擴展,切勿從其他範本匯入版面。若缺少某個區塊,請從頭以本範本的語彙重新設計。
- 確保動態內容的可及性。 每個動畫都必須遵循
prefers-reduced-motion,如同建置規範所要求。
輸出約定
在 <artifact> 標籤內輸出:
<artifact identifier="space-voyage-landing" type="text/html" title="Astra — 電影級太空旅行登陸頁面">
<!doctype html>
<html>...</html>
</artifact>
建置規範
以下是產生此設計的原始提示,逐字呈現。
Astra — 電影級太空旅行登陸頁面
概述
建立一個單頁太空旅行登陸頁面,包含兩個全高區塊——英雄區域與能力展示區——兩者皆疊加在循環播放的背景影片上,透過自訂的 rAF 驅動 JavaScript 程式碼(無 CSS 過渡效果)進行交叉淡入。頁面為所有鍍鉻元素(導航欄、標籤、卡片、行動呼籲按鈕)共享一套「液態玻璃」設計系統,並使用 Motion (Framer Motion) 處理進場動畫,包括逐字模糊入場標題。所有文字均為白色,顯示在滿版影片之上且無深色疊加層;對比度完全來自液態玻璃鍍鉻。
技術棧
- 執行時期 / 框架: React 18.3.1(UMD 開發版本,從 CDN 載入——無打包工具)。
- JSX 編譯: 透過 Babel Standalone 7.29.0 在瀏覽器中執行;每個元件都是一個
<script type="text/babel">檔案,並將自身匯出至window.X = X。 - 動畫: Framer Motion 11.11.17(UMD 版本,以
window.Motion暴露)。 - 樣式: Tailwind CSS 透過 CDN
<script>(https://cdn.tailwindcss.com) 載入,搭配行內tailwind.config,以及手寫的<style>區塊處理液態玻璃工具類別。 - 字體: Google Fonts — Instrument Serif (
ital@0;1) 用於標題,Barlow (wght@300;400;500;600) 用於內文。 - 掛載點: 透過
ReactDOM.createRoot在#root上掛載 React 應用程式。 - 值得注意的技術: 自訂 rAF 交叉淡入循環影片、IntersectionObserver 觸發的模糊入場文字、透過遮罩
::before偽元素實現的液態玻璃漸層邊框。
全域設定
index.html
<html lang="en">,charset UTF-8,響應式 viewport meta。<title>:astra — Venture Past Our Sky。- Favicon:一個行內 SVG data URI——黑色
rounded矩形 (rx='16'),中間有一個義大利斜體 Georgia 襯線小寫白色a。 - Body:
<body class="bg-black antialiased">,僅包含<div id="root"></div>,其後為 script 標籤。 html, body { background: #000; }在<style>區塊中設定。
CDN 腳本(鎖定版本,僅限 CDN)
按以下順序載入至 <head> 內:
<script src="https://cdn.tailwindcss.com"></script>
<script src="https://unpkg.com/[email protected]/umd/react.development.js" integrity="sha384-hD6/rw4ppMLGNu3tX5cjIb+uRZ7UkRJ6BPkLpg4hAu/6onKUg4lLsHAs9EBPT82L" crossorigin="anonymous"></script>
<script src="https://unpkg.com/[email protected]/umd/react-dom.development.js" integrity="sha384-u6aeetuaXnQ38mYT8rp6sbXaQe3NL9t+IBXmnYxwkUI2Hw4bsp2Wvmx4yRQF1uAm" crossorigin="anonymous"></script>
<script src="https://unpkg.com/@babel/[email protected]/babel.min.js" integrity="sha384-m08KidiNqLdpJqLq95G/LEi8Qvjl/xUYll3QILypMoQ65QorJ9Lvtp2RXYGBFj1y" crossorigin="anonymous"></script>
<script src="https://unpkg.com/[email protected]/dist/framer-motion.js"></script>
<script>window.Motion = window.FramerMotion;</script>
字體
<link rel="preconnect" href="https://fonts.googleapis.com" />
<link rel="preconnect" href="https://fonts.gstatic.com" crossorigin />
<link href="https://fonts.googleapis.com/css2?family=Instrument+Serif:ital@0;1&family=Barlow:wght@300;400;500;600&display=swap" rel="stylesheet" />
Tailwind 設定
在元件之前行內設定,擴展主題:
tailwind.config = {
theme: {
extend: {
fontFamily: {
heading: ['"Instrument Serif"', 'serif'],
body: ['Barlow', 'sans-serif'],
},
borderRadius: {
DEFAULT: '9999px',
},
},
},
};
font-heading→'Instrument Serif', serif(一律使用斜體)。font-body→'Barlow', sans-serif。- 預設 border-radius 覆寫
DEFAULT: '9999px',使單純的rounded變為膠囊形狀。
Framer Motion 開發警告抑制
Framer Motion 關於列表鍵值的開發警告是良性的;用一個 console.error 包裝器將其過濾掉:
(function () {
var origError = console.error;
console.error = function () {
var first = arguments[0];
if (typeof first === 'string' && (first.indexOf('unique "key" prop') !== -1 || first.indexOf('Each child in a list') !== -1)) return;
origError.apply(console, arguments);
};
})();
元件腳本載入順序
在 <body> 結尾處,依序載入每個 Babel 元件檔案:
<script type="text/babel" src="js/icons.js"></script>
<script type="text/babel" src="js/FadingVideo.js"></script>
<script type="text/babel" src="js/BlurText.js"></script>
<script type="text/babel" src="js/Navbar.js"></script>
<script type="text/babel" src="js/Hero.js"></script>
<script type="text/babel" src="js/Capabilities.js"></script>
<script type="text/babel" src="js/App.js"></script>
液態玻璃工具類別
<style> 區塊中有兩種變體——.liquid-glass(淡雅,用於導航欄/標籤/卡片)和 .liquid-glass-strong(較強模糊,用於主要行動呼籲按鈕)。每種都透過一個遮罩的 ::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;
}
.liquid-glass-strong {
background: rgba(255,255,255,0.01);
background-blend-mode: luminosity;
backdrop-filter: blur(50px);
-webkit-backdrop-filter: blur(50px);
border: none;
box-shadow: 4px 4px 4px rgba(0,0,0,0.05), inset 0 1px 1px rgba(255,255,255,0.15);
position: relative;
overflow: hidden;
}
.liquid-glass-strong::before {
content: "";
position: absolute; inset: 0;
border-radius: inherit;
padding: 1.4px;
background: linear-gradient(180deg,
rgba(255,255,255,0.5) 0%,
rgba(255,255,255,0.2) 20%,
rgba(255,255,255,0) 40%,
rgba(255,255,255,0) 60%,
rgba(255,255,255,0.2) 80%,
rgba(255,255,255,0.5) 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;
}
- 強變體與淡雅變體相同,但差異在於:
backdrop-filter: blur(50px)、box-shadow (4px 4px 4px rgba(0,0,0,0.05), inset 0 1px 1px rgba(255,255,255,0.15)),以及::before漸層色標(0.5 / 0.2 / 0 / 0 / 0.2 / 0.5)。
圖示 — js/icons.js
行內 Lucide 風格 SVG 圖示(currentColor 筆畫)加上 Material Icon 圖形。每個圖示都指派給 window。將所有內容包在一個 IIFE 中。
ArrowUpRight({ className })—24×24,viewBox="0 0 24 24",fill="none",stroke="currentColor",strokeWidth="2",圓頭端點/連接,aria-hidden。兩個路徑:M7 17L17 7和M7 7h10v10。PlayIcon({ className })—24×24,viewBox="0 0 24 24",fill="currentColor",stroke="none",aria-hidden。填色多邊形points="6 4 20 12 6 20 6 4"。ClockIcon— 一個白色28×28輪廓 SVG 圖示(時鐘),用於統計卡片 1。GlobeIcon— 一個白色28×28輪廓 SVG 圖示(地球),用於統計卡片 2。- Material Icons SVG — 一個白色 Material Icons SVG(
fill currentColor,h-6 w-6 text-white),用於能力卡片內部。
FadingVideo — js/FadingVideo.js
自訂 JS 交叉淡入循環影片。無 CSS 過渡效果:每次淡入都是由 rAF 驅動,循環是透過 ended 事件手動實作(原生 loop 屬性關閉)。
- 常數:
FADE_MS = 500,FADE_OUT_LEAD = 0.55(結束前開始淡出的秒數)。 FadingVideo({ src, className, style })渲染<video ref muted autoPlay playsInline preload="auto" />,帶有style={{ opacity: 0, ...style }}(從opacity: 0開始)。- 透過
React.useRef的 Refs:videoRef,rafRef(目前的 rAF id),fadingOutRef(布林值)。 - 所有連線邏輯都位於
React.useEffect(..., [src])中。
fadeTo(target, duration = FADE_MS):
- 如果
rafRef.current !== null,則在開始前呼叫cancelAnimationFrame(rafRef.current)(使新的淡入打斷前一個)。 - 使用
parseFloat(video.style.opacity || '0')讀取起始值,以便每個新的淡入從上一個停止的地方繼續。 - 使用
performance.now()作為開始時間;在每個requestAnimationFrame滴答中計算t = Math.min((now - start) / duration, 1),設定video.style.opacity = String(from + (target - from) * t),並持續請求框架直到t >= 1,然後設定rafRef.current = null。
事件處理器:
loadeddata:設定opacity = '0',video.play().catch(() => {}),然後fadeTo(1)。timeupdate:remaining = video.duration - video.currentTime;如果!fadingOutRef.current && remaining <= FADE_OUT_LEAD && remaining > 0,設定fadingOutRef.current = true並fadeTo(0)。ended:設定opacity = '0',然後在setTimeout(..., 100)之後重置currentTime = 0,play(),清除fadingOutRef.current = false,並fadeTo(1)。- 如果在附加監聽器時
video.readyState >= 2,則立即呼叫onLoadedData()。
卸載時清理: 取消 rAF (cancelAnimationFrame(rafRef.current)) 並移除所有三個監聽器。
BlurText — js/BlurText.js
逐字模糊入場標題,在可見度達 10% 時觸發。引入 const { motion } = window.Motion。常數 STEP_DURATION = 0.35。
BlurText({ text, className, delay = 100 })。- 一個 IntersectionObserver,使用
{ threshold: 0.1 },在首次交叉時設定inView = true,然後observer.unobserve(el);在清理時斷開連線。 - 按空格分割文字:
const words = text.split(' ')。 - 渲染一個
<p ref className>,樣式為display: flex; flexWrap: wrap; justifyContent: center; rowGap: 0.1em。 - 每個單詞都是一個
motion.span,帶有key={${word}-${i}}:initial={{ filter: 'blur(10px)', opacity: 0, y: 50 }}。- 當可見時,動畫關鍵幀:
否則保持在{ filter: ['blur(10px)', 'blur(5px)', 'blur(0px)'], opacity: [0, 0.5, 1], y: [50, -5, 0], }{ filter: 'blur(10px)', opacity: 0, y: 50 }。 transition={{ duration: STEP_DURATION * 2, times: [0, 0.5, 1], ease: 'easeOut', delay: (i * delay) / 1000 }}。style={{ display: 'inline-block', marginRight: '0.28em' }}——使用marginRight而非不斷行空格,因為-4px的字距會吃掉 nbsp。
Navbar — js/Navbar.js
浮動液態玻璃鍍鉻。引入 const { ArrowUpRight } = window。NAV_LINKS = ['Home', 'Voyages', 'Worlds', 'Innovation', 'Plan Launch']。
<nav>類別:fixed top-4 left-0 right-0 z-50 px-8 lg:px-16 flex items-center justify-between。- Logo(左側): 一個
<a href="#" aria-label="astra home">,帶有liquid-glass rounded-full w-12 h-12 flex items-center justify-center shrink-0。內部:<span class="font-heading italic text-white text-2xl leading-none -translate-y-px">a</span>(斜體襯線小寫 "a")。 - 中央膠囊(僅限桌機):
<div class="hidden md:flex items-center liquid-glass rounded-full px-1.5 py-1.5">,包含:- 5 個導航連結,每個
<a href="#" key={link}>帶有px-3 py-2 text-sm font-medium text-white/90 font-body whitespace-nowrap hover:text-white。 - 一個白色膠囊按鈕:
<a href="#" class="flex items-center gap-1.5 bg-white text-black rounded-full px-4 py-2 text-sm font-medium font-body whitespace-nowrap">,文字為Claim a Spot,後接<ArrowUpRight className="h-4 w-4" />。
- 5 個導航連結,每個
- 右側: 一個不可見的 48×48 間距元素,用於平衡 Logo——
<div class="w-12 h-12 invisible shrink-0" aria-hidden="true" />。
區塊 1 — 英雄區域 (js/Hero.js)
全視窗區塊:交叉淡入影片、導航欄、模糊入場標題、行動呼籲按鈕、統計卡片、合作夥伴列。引入 const { motion } = window.Motion 和 const { FadingVideo, BlurText, Navbar, ArrowUpRight, PlayIcon, ClockIcon, GlobeIcon } = window。
HERO_VIDEO = 'assets/hf_20260418_080021_d598092b-c4c2-4e53-8e46-94cf9064cd50.mp4'。
進場動畫輔助函式: 所有英雄區域內容都使用 Motion 進行動畫,使用:
const HIDDEN = { filter: 'blur(10px', opacity: 0, y: 20 };
- 背景影片容器:
<div class="fixed inset-0 w-full h-full overflow-hidden">,包含<FadingVideo src={HERO_VIDEO} className="w-full h-full object-cover" />。 - 內容容器:
<div class="relative z-10 flex flex-col items-center justify-center min-h-screen px-4 text-center">。 - 標題:
<BlurText text="Venture Past Our Sky" className="font-heading italic text-6xl md:text-8xl lg:text-9xl text-white leading-none mb-6" />。 - 副標題:
<motion.p initial={HIDDEN} whileInView={{ filter: 'blur(0px)', opacity: 1, y: 0 }} transition={{ duration: 0.8, delay: 0.3 }} ...>,帶有文字"Embark on a celestial journey to worlds beyond imagination."。 - 行動呼籲按鈕組:
<motion.div ... initial={HIDDEN} whileInView={{ filter: 'blur(0px)', opacity: 1, y: 0 }} transition={{ duration: 0.8, delay: 0.5 }}>,包含兩個按鈕:- 主要按鈕:
<a href="#" class="liquid-glass-strong rounded-full px-8 py-4 text-white font-body font-medium text-lg inline-flex items-center gap-2">帶有文字Explore Voyages和一個<ArrowUpRight className="h-5 w-5" />。 - 次要按鈕:
<a href="#" class="liquid-glass rounded-full px-8 py-4 text-white font-body font-medium text-lg inline-flex items-center gap-2">帶有<PlayIcon className="h-5 w-5" />和文字Watch Trailer(兩者皆帶有hover:bg-white/10 hover:scale-105 transition-all duration-300)。
- 主要按鈕:
- 統計卡片列: 一個
<motion.div ...>,包含 2 個統計卡片。每個卡片都是<div class="flex items-center gap-3 liquid-glass rounded-full px-6 py-3">:- 卡片 1:
<ClockIcon />加上<div><p class="font-heading italic text-3xl text-white">12+</p><p class="text-xs text-white/70 font-body">Missions</p></div>。 - 卡片 2:
<GlobeIcon />加上<div><p class="font-heading italic text-3xl text-white">47</p><p class="text-xs text-white/70 font-body">Worlds Mapped</p></div>。
- 卡片 1:
- 合作夥伴列:
<motion.div ...>,包含一個標題<p class="text-sm text-white/50 font-body tracking-widest uppercase mb-4">Trusted by leading space innovators</p>,以及 5 個合作夥伴 Logo(使用類別font-heading italic text-2xl text-white/30和名稱"OrbitX", "NovaCorp", "Stellaris", "Cosmic", "Aether")。
區塊 2 — 能力展示 (js/Capabilities.js)
第二個全高區塊,網格狀能力展示,附有文字和互動元素。引入 const { motion } = window.Motion 和 const { FadingVideo, BlurText, ArrowUpRight } = window。
CAPABILITIES_VIDEO = 'assets/hf_20260417_224513_a94918d4-ef6b-4afa-8465-afd36ad31c88.mp4'。
資料: capabilities = [
-
{ title: 'Interstellar Navigation', desc: 'Advanced AI-powered route planning across light-years.', img: 'https://placehold.co/600x400/1a1a2e/ffffff?text=Navigation' } -
{ title: 'Zero-G Manufacturing', desc: 'Precision fabrication in microgravity environments.', img: 'https://placehold.co/600x400/1a1a2e/ffffff?text=Manufacturing' } -
{ title: 'Quantum Communications', desc: 'Instantaneous data relay through quantum entanglement.', img: 'https://placehold.co/600x400/1a1a2e/ffffff?text=Communications' } -
{ title: 'Ecosystem Engineering', desc: 'Terraforming and habitat design for alien worlds.', img: 'https://placehold.co/600x400/1a1a2e/ffffff?text=Ecosystem' }]。 -
區塊容器:
<section class="relative min-h-screen flex items-center justify-center px-8 lg:px-16 py-24">。 -
背景影片:
<FadingVideo src={CAPABILITIES_VIDEO} className="absolute inset-0 w-full h-full object-cover" />。 -
內容(z-10、w-full):
<div class="relative z-10 w-full max-w-7xl mx-auto">。 -
區塊標題:
<BlurText text="Capabilities" className="font-heading italic text-6xl md:text-8xl text-white text-center mb-4" />。 -
區塊副標題:
<motion.p class="text-white/70 font-body text-center max-w-2xl mx-auto mb-16" 文字="From navigation to terraforming, our suite of capabilities enables humanity's greatest adventure." />。 -
能力網格:
<div class="grid grid-cols-1 md:grid-cols-2 gap-6">,每個{capability, index}產生一個<motion.div>卡片:initial={{ opacity: 0, y: 50 }} whileInView={{ opacity: 1, y: 0 }} transition={{ duration: 0.6, delay: index * 0.1 }}。- 卡片結構:
<div class="liquid-glass rounded-3xl overflow-hidden group cursor-pointer">,包含一個圖片<div class="overflow-hidden"><img src={capability.img} alt={capability.title} class="w-full h-48 object-cover transition-transform duration-500 group-hover:scale-105" /></div>和一個文字區塊<div class="p-6">,內部包含:- 一個
flex列,帶有<h3 class="font-heading italic text-2xl text-white">{capability.title}</h3>和<ArrowUpRight className="h-5 w-5 text-white/50 transition-all duration-300 group-hover:rotate-45 group-hover:text-white" />。 <p class="text-white/70 font-body text-sm mt-2">{capability.desc}</p>。- 底部:一個
<div class="flex items-center gap-2 mt-4">,包含 3 個標籤(類別liquid-glass rounded-full px-3 py-1 text-xs text-white/80 font-body),內容:['Propulsion', 'Guidance', 'AI']、['Materials', 'Robotics', 'Assembly']、['Encryption', 'Speed', 'Mesh']、['Ecology', 'Atmosphere', 'Synthesis']。
- 一個
- 卡片左上角有一個小的「New」徽章:
<span class="absolute top-4 left-4 liquid-glass rounded-full px-3 py-1 text-xs text-white font-body font-medium">New</span>。
App — js/App.js
根元件,組合 Hero 和 Capabilities。引入 const { Hero, Capabilities } = window。
function App() { return <><Hero /><Capabilities /></>; }ReactDOM.createRoot(document.getElementById('root')).render(<App />);- 將 App 匯出至
window(window.App = App;),僅供完整性。
使用來自 pulkitxm/claude-directory 的 MIT 授權建置。