Asme — 液態玻璃深色落地頁面
落地頁面取自 MIT 授權的
pulkitxm/claude-directory圖庫。
一個像素精準、深色主題的單頁行銷落地頁面,為 Asme 設計。Asme 是一個虛構的知識與洞察平台,其特色是標誌性的可重複使用 .liquid-glass 表面處理效果 — 包含亮度混合的半透明填充、4px 背景模糊、頂部內陰影,以及一個使用 ::before 偽元素製作的遮罩漸層邊框。此效果一致地應用於導覽列藥丸按鈕、電子郵件擷取區塊、按鈕、卡片和圖示標籤。全視窗英雄區域透過原生的 requestAnimationFrame 不透明度交叉淡入淡出效果,循環播放本機提供的 .mp4 影片(在 canplay 時淡入,在剩餘 0.55 秒時淡出,間隔 100ms 後重新開始)。四個由捲動觸發的區塊透過 Framer Motion 的 useInView 動畫呈現:關於、精選影片、創新 × 願景(影片加上從相反兩側滑入的兩欄內容),以及服務(兩張帶有懸停縮放影片的玻璃卡片)。全頁使用 Instrument Serif 顯示字體,並搭配純黑背景。
工作流程
- 將
example.html複製到使用者的工作目錄,作為工作檔案。 - 將預設內容取代為使用者實際的品牌名稱、標題、內文、數字和圖片。更換素材時,請保持現有圖片尺寸。
- 保留設計系統。 下方建構規範中的色板、字體比例、間距節奏和動態效果是核心識別 — 請勿替換字體、更改色板顏色或移除裝飾元素。
- 透過複製現有區塊來擴展,切勿從其他模板匯入版面。如果缺少某個區塊,請使用此模板自身的設計語言從頭開始設計。
- 保持動畫的可及性。 所有動畫都必須遵守
prefers-reduced-motion設定,正如建構規範所要求。
輸出契約
在 <artifact> 標籤之間輸出:
<artifact identifier="asme-liquid-glass-landing" type="text/html" title="Asme — Liquid Glass Dark Landing Page">
<!doctype html>
<html>...</html>
</artifact>
建構規範
以下為產生此設計的原始提示內容。
Asme — 液態玻璃落地頁面
概述
為「Asme」建立一個深色主題的單頁行銷落地網站,包含一個全視窗循環播放的英雄影片和一個標誌性的「液態玻璃」表面處理效果(毛玻璃模糊 + 漸層邊框),並重複應用於每個 UI 元素。英雄影片下方,四個透過捲動觸發的區塊(關於、精選影片、理念、服務)會動態顯示,所有內容都設定在純黑背景上,並輔以 Instrument Serif 字體作為點綴。
技術棧
- 框架: React 18.3.1 搭配 TypeScript 5.6.3,由 Vite 5.4.10(
@vitejs/plugin-react4.3.3)打包。 - 樣式: Tailwind CSS 3.4.14 搭配 PostCSS 8.4.49 和 Autoprefixer 10.4.20。
- 動畫: Framer Motion 11.11.17(
motion、useInView、MotionConfig)。 - 圖示: Lucide React 0.460.0(
ArrowRight、ArrowUpRight、Globe、Instagram、Twitter)。 - 字體: Instrument Serif(一般 + 斜體),透過 Google Fonts 載入。
- 值得注意的技術: 可重複使用的
.liquid-glass組件類別(背景模糊 + 透過::before製作的遮罩漸層邊框)、用於英雄影片循環的原生 JavaScript /requestAnimationFrame交叉淡入淡出(無 CSS 過渡)、useInView捲動觸發的入場動畫、從/assets/提供的本機.mp4檔案。
全域設定
文件 (index.html)
<html lang="en" class="bg-black">和<body class="bg-black">。- Favicon 是一個白色地球/圓圈的內聯 SVG 資料 URI(
stroke='white'、stroke-width='2')。 <title>:Asme — Know it all.- Meta 描述:
Asme — Know it all. Stay updated with the latest news and insights. - Viewport meta:
width=device-width, initial-scale=1.0。 - 掛載到
<div id="root"></div>並以模組方式載入/src/main.tsx。
進入點 (src/main.tsx)
import React from 'react';
import ReactDOM from 'react-dom/client';
import { MotionConfig } from 'framer-motion';
import Index from './pages/Index';
import './index.css';
ReactDOM.createRoot(document.getElementById('root')!).render(
<React.StrictMode>
<MotionConfig reducedMotion="user">
<Index />
</MotionConfig>
</React.StrictMode>,
);
Tailwind 設定 (tailwind.config.js)
content:['./index.html', './src/**/*.{ts,tsx}']。- 擴展
theme.fontFamily,加入一個自訂的instrument系列,使font-instrument工具類別對應到'Instrument Serif', serif:
/** @type {import('tailwindcss').Config} */
export default {
content: ['./index.html', './src/**/*.{ts,tsx}'],
theme: {
extend: {
fontFamily: {
instrument: ["'Instrument Serif'", 'serif'],
},
},
},
plugins: [],
};
全域樣式 (src/index.css)
先匯入字體,然後是 Tailwind 層,最後是基礎和組件層。
@import url('https://fonts.googleapis.com/css2?family=Instrument+Serif:ital@0;1&display=swap');
@tailwind base;
@tailwind components;
@tailwind utilities;
@layer base {
html {
@apply bg-black;
}
body {
@apply bg-black text-white antialiased;
}
::selection {
background: rgba(255, 255, 255, 0.25);
color: #000;
}
:focus-visible {
outline: 1px solid rgba(255, 255, 255, 0.5);
outline-offset: 2px;
}
}
液態玻璃類別 (src/index.css,在 @layer components 內)
建立一個可重複使用的 .liquid-glass 類別,用於每個玻璃元素。它將一個近乎透明的亮度混合背景與 4px 的背景模糊和頂部內陰影相結合;一個遮罩的 ::before 會繪製一個薄的(1.4px)垂直漸層邊框,在頂部和底部最亮。
@layer components {
.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;
}
}
版面與頁面結構 (src/pages/Index.tsx)
頁面根元素為 <main className="bg-black">,依序包含:英雄 <section>,然後是 <AboutSection />、<FeaturedVideoSection />、<PhilosophySection /> 和 <ServicesSection />。
在模組作用域定義的常數:
HERO_VIDEO_URL = '/assets/hf_20260405_074625_a81f018a-956b-43fb-9aee-4d1508e30e6a.mp4'FADE_MS = 500FADE_OUT_LEAD_S = 0.55RESTART_DELAY_MS = 100NAV_LINKS = ['Features', 'Pricing', 'About']
素材說明: 所有五個影片均在本機提供,並從
/assets/目錄提供。檔案名稱源自 CloudFront 上傳(例如hf_20260405_074625_a81f018a-956b-43fb-9aee-4d1508e30e6a.mp4),但應用程式引用的是相對路徑/assets/...,而非任何外部主機。
區塊 1 — 英雄(全視窗)
容器:<section className="min-h-screen overflow-hidden relative flex flex-col">。
背景影片
<video>包含ref={videoRef}、類別absolute inset-0 w-full h-full object-cover object-bottom、src={HERO_VIDEO_URL}。- 屬性:
muted、autoPlay、playsInline、preload="auto"、aria-hidden="true"、tabIndex={-1}。 - 內聯樣式
style={{ opacity: 0 }}— 初始完全透明。
影片淡入淡出邏輯(透過 refs 的原生 JavaScript,無 CSS 過渡)
在 useEffect 中使用 useRef 控制代碼實現:videoRef、rafRef(活躍的 requestAnimationFrame ID)、restartTimerRef(重新啟動的 setTimeout ID)、hasStartedRef 和 isFadingOutRef。
animateOpacity(from, to, onDone?): 取消任何正在進行的影格,記錄performance.now()作為開始時間,並在每次requestAnimationFrame步驟中計算t = Math.min((now - start) / FADE_MS, 1),設定video.style.opacity = String(from + (to - from) * t)。當t >= 1時,清除rafRef並呼叫onDone。- 在
canplay時: 如果尚未開始,標記hasStartedRef,呼叫video.play()(抑制自動播放被封鎖的拒絕),然後animateOpacity(0, 1)。 - 在
timeupdate時: 如果尚未淡出且video.duration是有限的,計算remaining = video.duration - video.currentTime;當remaining <= FADE_OUT_LEAD_S(0.55 秒)時,設定isFadingOutRef,讀取當前不透明度(Number.parseFloat(video.style.opacity || '1')),並animateOpacity(current, 0)。 - 在
ended時: 設定opacity = '0',然後在RESTART_DELAY_MS(100 毫秒)後,重設currentTime = 0,再次play(),清除isFadingOutRef,並animateOpacity(0, 1)。 - 此效果的清理函式會移除所有三個監聽器,取消任何待處理的影格,並清除重新啟動計時器。
這會產生一個無縫循環,在每次播放之間有平滑的淡入到黑色效果。
導覽列
<header className="relative z-20 px-6 py-6"> 包含一個 <nav className="liquid-glass rounded-full max-w-5xl mx-auto px-6 py-3 flex items-center justify-between">。
- 左側群組(
flex items-center):- 品牌連結(
flex items-center gap-2.5、aria-label="Asme home"):Globe圖示(size={24}、text-white)+<span className="text-white font-semibold text-lg">Asme</span>。 - 導覽連結容器
hidden md:flex items-center gap-8 ml-8,呈現NAV_LINKS(「Features」、「Pricing」、「About」)的每個項目,作為<a>元素,類別為text-white/80 hover:text-white text-sm font-medium transition-colors。
- 品牌連結(
- 右側群組(
flex items-center gap-4):- 「Sign Up」文字按鈕:
text-white text-sm font-medium。 - 「Login」按鈕:
liquid-glass rounded-full px-6 py-2 text-white text-sm font-medium hover:bg-white/5 transition-colors。
- 「Sign Up」文字按鈕:
英雄內容
<div className="relative z-10 flex-1 flex flex-col items-center justify-center px-6 py-12 text-center -translate-y-[20%]">:
- 標題
<h1>,類別為text-7xl md:text-8xl lg:text-9xl text-white tracking-tight whitespace-nowrap mb-10,內聯樣式style={{ fontFamily: "'Instrument Serif', serif" }}。內容:Know it <em className="italic">all</em>.(渲染為「Know it all.」)。 - 電子郵件表單
<form className="liquid-glass rounded-full max-w-xl w-full pl-6 pr-2 py-2 flex items-center gap-3">,onSubmit呼叫event.preventDefault():<input type="email" autoComplete="email" placeholder="Enter your email" aria-label="Email address" className="flex-1 min-w-0 bg-transparent text-white placeholder:text-white/40 text-sm outline-none" />。- 提交按鈕(
type="submit"、aria-label="Subscribe"):bg-white rounded-full p-3 text-black shrink-0 hover:bg-white/90 transition-colors,包含一個ArrowRight圖示(size={20})。
- 副標題
<p className="text-white text-sm leading-relaxed px-4 mt-6 max-w-md">:「Stay updated with the latest news and insights. Subscribe to our newsletter today and never miss out on exciting updates.」 - 宣言按鈕
<button type="button" className="liquid-glass rounded-full px-8 py-3 text-white text-sm font-medium hover:bg-white/5 transition-colors mt-8">,文字為「Manifesto」。
社交圖示頁尾
<footer className="relative z-10 flex justify-center gap-4 pb-12">,映射 [{ label: 'Instagram', Icon: Instagram }, { label: 'Twitter', Icon: Twitter }, { label: 'Website', Icon: Globe }]。每個項目渲染為一個 <a>(href="#"、aria-label={label}),類別為 liquid-glass rounded-full p-4 text-white/80 hover:text-white hover:bg-white/5 transition-all,包含尺寸為 size={20} 的圖示。
區塊 2 — 關於 (src/components/AboutSection.tsx)
- 使用
useRef+useInView(ref, { once: true, margin: '-100px' })。 - 區塊:
<section ref={ref} className="relative bg-black pt-32 md:pt-44 pb-10 md:pb-14 px-6 overflow-hidden">。 - 放射狀漸層疊加層(
absolute inset-0、aria-hidden):bg-[radial-gradient(ellipse_at_top,_rgba(255,255,255,0.03)_0%,_transparent_70%)]。 - 內部包裝器:
relative max-w-5xl mx-auto text-center。 - 標籤
motion.p,類別為text-white/40 text-sm tracking-widest uppercase mb-8,文字「About Us」。動畫initial={{ opacity: 0, y: 20 }}→{ opacity: 1, y: 0 }在可見時觸發,transition={{ duration: 0.6 }}。 - 標題
motion.h2,類別為text-4xl md:text-6xl lg:text-7xl text-white leading-[1.1] tracking-tight。動畫initial={{ opacity: 0, y: 40 }}→{ opacity: 1, y: 0 },transition={{ duration: 0.8, delay: 0.1 }}。結構:Pioneering然後<span className="font-instrument italic text-white/60">ideas</span>然後for<br className="hidden md:block" />minds that然後<span className="font-instrument italic text-white/60">create, build, and inspire.</span>
區塊 3 — 精選影片 (src/components/FeaturedVideoSection.tsx)
FEATURED_VIDEO_URL = '/assets/hf_20260402_054547_9875cfc5-155a-4229-8ec8-b7ba7125cbf8.mp4'。- 相同的
useInView模式({ once: true, margin: '-100px' })。 - 區塊:
<section ref={ref} className="bg-black pt-6 md:pt-10 pb-20 md:pb-32 px-6 overflow-hidden">,內部max-w-6xl mx-auto。 - 影片容器
motion.div className="relative rounded-3xl overflow-hidden aspect-video",動畫initial={{ opacity: 0, y: 60 }}→{ opacity: 1, y: 0 },transition={{ duration: 0.9 }}。<video className="w-full h-full object-cover" src={FEATURED_VIDEO_URL}>,包含muted、autoPlay、loop、playsInline、preload="auto"、aria-hidden、tabIndex={-1}。- 漸層疊加層(
absolute inset-0、aria-hidden):bg-gradient-to-t from-black/60 via-transparent to-transparent。 - 底部疊加層
<div className="absolute bottom-0 left-0 right-0 p-6 md:">
...(為簡潔起見截斷)
區塊 4 — 創新 × 願景 (src/components/PhilosophySection.tsx)
...(省略詳細的 JSX 結構)
區塊 5 — 服務 (src/components/ServicesSection.tsx)
...(省略詳細的 JSX 結構)
注意事項與約定
- 所有路徑均相對於專案根目錄。
- 素材(影片)必須放置於
/assets/目錄下。 - 此頁面設計為靜態展示,無後端整合。
- 動畫效果遵循
prefers-reduced-motion媒體查詢。