Asme — 液态玻璃暗色落地页
落地页源自 MIT 许可的
pulkitxm/claude-directory图库。
一个像素级精确、深色主题的单页营销落地页,专为虚构知识平台 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 — 液态玻璃暗色落地页">
<!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滚动触发的入场动画,本地托管的.mp4素材文件存放于/assets/路径下。
全局设置
文档(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.- 元描述:
Asme — Know it all. Stay updated with the latest news and insights. - 视口元标签:
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)。 - 此 effect 的清理函数会移除所有三个监听器,取消任何待处理的帧,并清除重启计时器。
这会生成一个无缝循环,在播放之间通过平滑的交叉淡入淡出变为黑色。
导航栏
<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:">