premium-frontend-design

Compare original and translation side by side

🇺🇸

Original

English
🇨🇳

Translation

Chinese

Premium Frontend Design Skill

高端前端设计技能

This skill guides creation of production-grade frontend interfaces that feel ALIVE — not generic, not copy-paste, but genuinely crafted experiences that users remember.
"The difference between a good interface and an unforgettable one is intentionality in every pixel."

本技能指导打造具有生命力的生产级前端界面——绝非千篇一律、复制粘贴的产物,而是能让用户铭记的精心雕琢的体验。
“优秀界面与令人难忘的界面之间的区别,在于每一个像素的用心设计。”

Dependencies (Flexible — Choose What Fits)

依赖项(灵活选择)

This skill is framework-flexible. Pick packages based on user preference and project needs.
本技能框架无关,可根据用户偏好和项目需求选择合适的包。

Core 3D (for WebGL templates)

核心3D库(用于WebGL模板)

bash
pnpm add three @react-three/fiber @react-three/drei
bash
pnpm add three @react-three/fiber @react-three/drei

Animation (choose based on user preference)

动画库(根据偏好选择)

LibraryBest ForComplexityBundle Size
CSS/TailwindSimple transitions, micro-interactionsLow0KB
Framer MotionReact-native feel, layout animations, gesturesMedium~30KB
GSAPComplex timelines, scroll-triggered, text effectsHigh~60KB
GSAP + ClubSplitText, ScrollTrigger, MorphSVGHigh~80KB
bash
undefined
最佳适用场景复杂度包体积
CSS/Tailwind简单过渡、微交互0KB
Framer Motion类React Native体验、布局动画、手势交互~30KB
GSAP复杂时间线、滚动触发动画、文本特效~60KB
GSAP + Club文本拆分、滚动触发、SVG变形~80KB
bash
undefined

Framer Motion (simpler, React-idiomatic)

Framer Motion(更简洁,符合React风格)

pnpm add framer-motion
pnpm add framer-motion

GSAP (powerful, timeline-based)

GSAP(功能强大,基于时间线)

pnpm add gsap @gsap/react
pnpm add gsap @gsap/react

Note: SplitText, ScrollTrigger require GSAP Club license

注意:SplitText、ScrollTrigger需要GSAP Club授权


**Decision Guide:**
- User says "simple" or "lightweight" → CSS + Framer Motion
- User says "complex animations" or "scroll effects" → GSAP
- User says "text animations" or "split text" → GSAP + SplitText
- User doesn't specify → Default to Framer Motion (simpler API)

**决策指南:**
- 用户提及“简单”或“轻量” → CSS + Framer Motion
- 用户提及“复杂动画”或“滚动特效” → GSAP
- 用户提及“文本动画”或“文本拆分” → GSAP + SplitText
- 用户未指定 → 默认使用Framer Motion(API更简洁)

Optional Enhancements

可选增强库

bash
undefined
bash
undefined

Mesh gradients (for mesh-gradient-hero)

网格渐变(用于mesh-gradient-hero)

pnpm add @paper-design/shaders-react
pnpm add @paper-design/shaders-react

Icons

图标库

pnpm add lucide-react
pnpm add lucide-react

Charts/Sparklines (for dashboards)

图表/迷你折线图(用于仪表盘)

pnpm add recharts
pnpm add recharts

or lightweight: pnpm add @visx/shape @visx/scale

或轻量替代:pnpm add @visx/shape @visx/scale

undefined
undefined

Browser Compatibility Notes

浏览器兼容性说明

  • backdrop-filter
    : Not supported in Firefox < 103 (add fallback bg)
  • WebGL: Provide CSS fallback for older devices
  • @starting-style
    : Chrome 117+, Safari 17.4+ (progressive enhancement)

  • backdrop-filter
    :Firefox < 103版本不支持(需添加背景降级方案)
  • WebGL:为旧设备提供CSS降级方案
  • @starting-style
    :Chrome 117+、Safari 17.4+支持(渐进式增强)

Core Philosophy

核心设计理念

The "Alive" Principle

“生命力”原则

An interface feels alive when:
  • It breathes: Subtle ambient animations, particles, or shader effects create constant but non-distracting motion
  • It responds: Micro-interactions acknowledge every user action with satisfying feedback
  • It has depth: Layers, parallax, glassmorphism, and shadows create dimensional space
  • It surprises: At least one element breaks expectations in a delightful way
界面具有生命力的表现:
  • 会呼吸:微妙的环境动画、粒子效果或着色器特效,创造持续但不分散注意力的动态
  • 有响应:微交互对每一次用户操作给出令人愉悦的反馈
  • 有深度:分层设计、视差效果、玻璃态和阴影营造出空间感
  • 有惊喜:至少有一个元素以令人愉悦的方式打破常规预期

Design Thinking (Before ANY Code)

设计思考(编写代码前)

Before writing a single line, answer these:
  1. Purpose: What problem does this solve? Who uses it?
  2. Tone: Pick ONE extreme direction (not a blend):
    • Brutally minimal
    • Maximalist chaos
    • Retro-futuristic / Cyberpunk
    • Organic / Natural
    • Luxury / Refined
    • Playful / Toy-like
    • Editorial / Magazine
    • Brutalist / Raw
    • Art Deco / Geometric
    • Industrial / Utilitarian
    • Bio-luminescent / Sci-fi
    • Mission Control / Technical
  3. The One Thing: What single element will someone remember? Every great interface has a signature moment.
  4. Constraints: Framework, performance budgets, accessibility requirements.
CRITICAL: Bold maximalism and refined minimalism both work. The key is intentionality, not intensity. A single, perfectly-executed animation beats 50 mediocre ones.

在编写任何代码之前,先回答以下问题:
  1. 目的:解决什么问题?目标用户是谁?
  2. 风格基调:选择一种极端方向(而非混合风格):
    • 极简主义
    • 极繁主义
    • 复古未来主义/赛博朋克
    • 有机/自然风
    • 奢华/精致风
    • 趣味/玩具风
    • 编辑/杂志风
    • 粗野主义/原始风
    • 装饰艺术/几何风
    • 工业/实用风
    • 生物发光/科幻风
    • 任务控制/技术风
  3. 核心记忆点:用户会记住哪个单一元素?每个优秀界面都有一个标志性亮点。
  4. 约束条件:框架限制、性能预算、无障碍要求。
关键提示:大胆的极繁主义和精致的极简主义都能奏效,核心在于用心设计,而非复杂度。一个完美执行的动画胜过50个平庸的动画。

Wow + Clarity Framework

惊艳+清晰框架

Use this whenever the brief is vague or when you need to justify design decisions. The goal is wow factor with purpose.
当需求模糊或需要证明设计决策合理性时使用此框架。目标是有目的的惊艳效果

1. Hierarchy Guardrails

1. 层级设计准则

  • 1 hero flourish (shader, particle system, or globe). Everything else supports readability.
  • 1 supporting flourish (micro-interactions, animated stat card, or glowing CTA). No more.
  • Layout rule:
    Hero (wild) → Content blocks (calm) → Proof (calm) → CTA (highlighted)
    .
  • If the page has more than one scroll-length of copy, every second section should be mostly static.
  • 1个核心视觉亮点(着色器、粒子系统或地球模型),其余元素服务于可读性
  • 1个辅助视觉亮点(微交互、动画统计卡片或发光CTA按钮),最多不超过一个
  • 布局规则:
    Hero(视觉冲击力强)→ 内容区块(简洁)→ 案例证明(简洁)→ CTA(高亮)
  • 如果页面内容超过一屏滚动长度,每隔一个部分应保持基本静态

2. Typography Discipline

2. 排版规范

  • Max 2 headliner fonts (display + body). Monospace only for data.
  • Headline letter-spacing ≥ -0.04em. Anything tighter kills readability.
  • Body width target: 55–75 characters per line on desktop, 35–45 on mobile.
  • Always pair big display text with a plain supporting sentence under 80 characters.
  • 最多2种标题字体(展示字体+正文字体),数据内容仅使用等宽字体
  • 标题字间距 ≥ -0.04em,过窄会影响可读性
  • 桌面端正文每行55–75个字符,移动端35–45个字符
  • 大尺寸展示文本下方始终搭配一句不超过80字符的简洁辅助说明

3. Color & Contrast Rules

3. 色彩与对比度规则

  • Limit neon usage to primary CTA + 1 accent. Everything else stays in zinc/neutral palette.
  • If background is busy (shader, gradients, particles), add a
    bg-black/70
    or
    bg-slate-950/70
    scrim behind text.
  • Keep contrast ratios ≥ 4.5:1 for body copy even if the aesthetic is cyberpunk.
  • Add a grayscale preview check before shipping: if it looks muddy, dial the palette back.
  • 霓虹色仅用于主CTA按钮+1个强调元素,其余部分使用锌色/中性色板
  • 如果背景复杂(着色器、渐变、粒子),在文本后方添加
    bg-black/70
    bg-slate-950/70
    遮罩层
  • 即使是赛博朋克风格,正文文本对比度也需保持≥4.5:1
  • 上线前进行灰度预览检查:如果视觉效果模糊,需调整色板

4. Motion Throttle

4. 动画节制准则

  • Default: CSS or Framer Motion with durations ≤ 400ms, easing
    cubic-bezier(0.34, 1.56, 0.64, 1)
    .
  • Escalate to GSAP/WebGL only if the brief explicitly asks for cinematic or interactive experiences.
  • Max 1 continuous animation per viewport (e.g., shader OR wave bars, not both).
  • Provide a “calm mode”: disable non-essential motion when
    prefers-reduced-motion
    is on OR when user scrolls past hero.
  • 默认:使用CSS或Framer Motion,动画时长≤400ms,缓动函数
    cubic-bezier(0.34, 1.56, 0.64, 1)
  • 仅当需求明确要求电影级或交互式体验时,才升级使用GSAP/WebGL
  • 每个视口最多保留1个持续动画(例如:着色器或波浪条,不同时使用)
  • 提供“安静模式”:当
    prefers-reduced-motion
    开启或用户滚动过Hero区域时,禁用非必要动画

5. When Requirements Are Vague

5. 需求模糊时的默认方案

SituationDefaultOptional Upgrade
User only says “clean SaaS”
mesh-gradient-hero
+
bento-grid
Swap hero background for CPPN if they later ask for “more energy”
User says “dashboard” with no flair
bento-grid
+
dashboard-widgets
+ CSS glow pills
Add
digital-liquid
shader only after data viz is signed off
User says “hero section” but nothing elseText-first layout + CSS gradientOffer shader/globe as a suggestion, never as default
If the prompt does not explicitly mention WebGL, assume CSS-first and opt-in to shaders only when the user embraces the cost.

场景默认方案可选升级
用户仅说“简洁SaaS”
mesh-gradient-hero
+
bento-grid
如果用户后续要求“更有活力”,将Hero背景替换为CPPN效果
用户说“仪表盘”但无额外风格要求
bento-grid
+
dashboard-widgets
+ CSS发光胶囊
仅在数据可视化确认后添加
digital-liquid
着色器
用户说“Hero区域”但无其他描述文本优先布局 + CSS渐变主动提议着色器/地球模型作为可选方案,而非默认实现
如果提示未明确提及WebGL,默认采用CSS优先方案,仅当用户接受性能成本时才引入着色器。

Anti-Patterns (NEVER Do This)

反模式(绝对避免)

Visual Anti-Patterns

视觉反模式

❌ White/light backgrounds as default (dark mode is premium) ❌ Generic gradients (purple-to-blue on white is AI slop) ❌ Evenly-distributed, timid color palettes ❌ Static, lifeless backgrounds ❌ Cookie-cutter component layouts ❌ Missing loading/transition states ❌ Jarring, un-eased animations
❌ 默认使用白色/浅色背景(深色模式更显高端) ❌ 通用渐变(白色背景上的紫蓝渐变是AI生成的平庸产物) ❌ 均匀分布、保守的色板 ❌ 静态、毫无生气的背景 ❌ 千篇一律的组件布局 ❌ 缺失加载/过渡状态 ❌ 突兀、无缓动的动画

Typography Anti-Patterns

排版反模式

❌ Inter, Roboto, Arial, system fonts for headlines ❌ Same font for everything ❌ Default line-heights and letter-spacing ❌ Boring, predictable type scales
❌ 使用Inter、Roboto、Arial等系统字体作为标题 ❌ 所有内容使用同一种字体 ❌ 默认行高和字间距 ❌ 乏味、可预测的字体层级

Code Anti-Patterns

代码反模式

❌ Inline styles scattered randomly ❌ No CSS variables for theming ❌ Animations without
will-change
or GPU acceleration ❌ Canvas/WebGL without
requestAnimationFrame
❌ Missing cleanup in
useEffect

❌ 随机散布内联样式 ❌ 未使用CSS变量实现主题化 ❌ 动画未添加
will-change
或GPU加速 ❌ Canvas/WebGL未使用
requestAnimationFrame
useEffect
中未添加清理逻辑

Design System

设计系统

1. Color Architecture

1. 色彩架构

Rule: ONE dominant accent, everything else supports it.
typescript
// Premium Dark Theme (Default)
const colors = {
  // Backgrounds (layer from darkest to lightest)
  bg: {
    void: '#000000',      // True black for maximum contrast
    primary: '#050505',   // Main background
    elevated: '#0a0a0a',  // Cards, modals
    subtle: '#111111',    // Hover states
  },
  
  // Glass surfaces
  glass: {
    bg: 'rgba(255, 255, 255, 0.03)',
    border: 'rgba(255, 255, 255, 0.08)',
    hover: 'rgba(255, 255, 255, 0.06)',
  },
  
  // Text hierarchy
  text: {
    primary: '#ffffff',
    secondary: '#a1a1aa',   // zinc-400
    muted: '#71717a',       // zinc-500
    ghost: '#3f3f46',       // zinc-700
  },
  
  // Accent (choose ONE per project)
  accent: '#ff4d00',  // Neon Orange
  // accent: '#00f3ff',  // Neon Cyan
  // accent: '#ccff00',  // Neon Lime
  // accent: '#F5E445',  // Premium Yellow
  // accent: '#a855f7',  // Electric Purple
}
Accent Usage Rules:
  • Primary actions: Full accent color
  • Secondary elements: Accent at 20% opacity
  • Borders/lines: Accent at 30% opacity
  • Glows: Accent with blur, 40-60% opacity
  • Never use accent for large background areas
规则:一种主导强调色,其余颜色为其服务。
typescript
// 高端深色主题(默认)
const colors = {
  // 背景色(从最深到最浅分层)
  bg: {
    void: '#000000',      // 纯黑,最大化对比度
    primary: '#050505',   // 主背景色
    elevated: '#0a0a0a',  // 卡片、模态框背景
    subtle: '#111111',    // 悬停状态背景
  },
  
  // 玻璃态表面
  glass: {
    bg: 'rgba(255, 255, 255, 0.03)',
    border: 'rgba(255, 255, 255, 0.08)',
    hover: 'rgba(255, 255, 255, 0.06)',
  },
  
  // 文本层级
  text: {
    primary: '#ffffff',
    secondary: '#a1a1aa',   // zinc-400
    muted: '#71717a',       // zinc-500
    ghost: '#3f3f46',       // zinc-700
  },
  
  // 强调色(每个项目选择一种)
  accent: '#ff4d00',  // 霓虹橙
  // accent: '#00f3ff',  // 霓虹青
  // accent: '#ccff00',  // 霓虹绿
  // accent: '#F5E445',  // 高端黄
  // accent: '#a855f7',  // 电光紫
}
强调色使用规则:
  • 主操作按钮:使用全色值强调色
  • 次要元素:使用20%透明度的强调色
  • 边框/线条:使用30%透明度的强调色
  • 发光效果:使用40-60%透明度的强调色并添加模糊
  • 绝不要将强调色用于大面积背景

2. Typography System

2. 排版系统

Rule: Display font for impact, Body font for reading, Mono for data.
css
/* Tier 1: Display/Headlines - BOLD, characterful */
--font-display: 'Chakra Petch', 'Orbitron', 'Bebas Neue', 'Playfair Display';

/* Tier 2: Headings - Geometric, modern */
--font-heading: 'Manrope', 'Outfit', 'Syne', 'Space Grotesk';

/* Tier 3: Body - Clean, highly legible */
--font-body: 'Plus Jakarta Sans', 'DM Sans', 'Satoshi', 'General Sans';

/* Tier 4: Data/Code - ALWAYS monospace */
--font-mono: 'JetBrains Mono', 'Fira Code', 'IBM Plex Mono';
Typography Patterns:
css
/* Hero Headlines: Massive, tight, aggressive */
.headline {
  font-family: var(--font-display);
  font-size: clamp(3rem, 12vw, 10rem);
  font-weight: 800;
  line-height: 0.9;
  letter-spacing: -0.03em;
  text-transform: uppercase;
}

/* Section Titles */
.section-title {
  font-family: var(--font-heading);
  font-size: clamp(1.5rem, 4vw, 3rem);
  font-weight: 700;
  letter-spacing: -0.02em;
}

/* Technical Labels */
.label {
  font-family: var(--font-mono);
  font-size: 0.75rem;
  font-weight: 500;
  text-transform: uppercase;
  letter-spacing: 0.1em;
  color: var(--text-muted);
}

/* Data Display */
.data {
  font-family: var(--font-mono);
  font-variant-numeric: tabular-nums;
}
规则:展示字体用于视觉冲击,正文字体用于阅读,等宽字体用于数据。
css
/* 第一层:展示/标题字体 - 粗体、有特色 */
--font-display: 'Chakra Petch', 'Orbitron', 'Bebas Neue', 'Playfair Display';

/* 第二层:标题字体 - 几何风格、现代感 */
--font-heading: 'Manrope', 'Outfit', 'Syne', 'Space Grotesk';

/* 第三层:正文字体 - 简洁、高可读性 */
--font-body: 'Plus Jakarta Sans', 'DM Sans', 'Satoshi', 'General Sans';

/* 第四层:数据/代码字体 - 必须使用等宽字体 */
--font-mono: 'JetBrains Mono', 'Fira Code', 'IBM Plex Mono';
排版模式:
css
/* Hero标题:超大字号、紧凑、有冲击力 */
.headline {
  font-family: var(--font-display);
  font-size: clamp(3rem, 12vw, 10rem);
  font-weight: 800;
  line-height: 0.9;
  letter-spacing: -0.03em;
  text-transform: uppercase;
}

/* 章节标题 */
.section-title {
  font-family: var(--font-heading);
  font-size: clamp(1.5rem, 4vw, 3rem);
  font-weight: 700;
  letter-spacing: -0.02em;
}

/* 技术标签 */
.label {
  font-family: var(--font-mono);
  font-size: 0.75rem;
  font-weight: 500;
  text-transform: uppercase;
  letter-spacing: 0.1em;
  color: var(--text-muted);
}

/* 数据展示 */
.data {
  font-family: var(--font-mono);
  font-variant-numeric: tabular-nums;
}

3. Spacing & Layout

3. 间距与布局

Rule: Asymmetry creates interest. Grids are starting points, not prisons.
css
/* Spacing scale (use consistently) */
--space-1: 0.25rem;   /* 4px */
--space-2: 0.5rem;    /* 8px */
--space-3: 0.75rem;   /* 12px */
--space-4: 1rem;      /* 16px */
--space-6: 1.5rem;    /* 24px */
--space-8: 2rem;      /* 32px */
--space-12: 3rem;     /* 48px */
--space-16: 4rem;     /* 64px */
--space-24: 6rem;     /* 96px */
--space-32: 8rem;     /* 128px */

/* Use generous padding on containers */
.container {
  padding-inline: clamp(1rem, 5vw, 4rem);
}

/* Hero sections need breathing room */
.hero {
  min-height: 100vh;
  padding-block: var(--space-32);
}
Bento Grid Pattern (for dashboards):
css
.bento {
  display: grid;
  grid-template-columns: repeat(4, 1fr);
  grid-auto-rows: minmax(150px, auto);
  gap: var(--space-4);
}

/* Feature card spans */
.card-hero { grid-column: span 2; grid-row: span 2; }
.card-wide { grid-column: span 2; }
.card-tall { grid-row: span 2; }

规则:不对称设计更具吸引力,网格是起点而非束缚。
css
/* 间距刻度(保持一致使用) */
--space-1: 0.25rem;   /* 4px */
--space-2: 0.5rem;    /* 8px */
--space-3: 0.75rem;   /* 12px */
--space-4: 1rem;      /* 16px */
--space-6: 1.5rem;    /* 24px */
--space-8: 2rem;      /* 32px */
--space-12: 3rem;     /* 48px */
--space-16: 4rem;     /* 64px */
--space-24: 6rem;     /* 96px */
--space-32: 8rem;     /* 128px */

/* 容器使用充足内边距 */
.container {
  padding-inline: clamp(1rem, 5vw, 4rem);
}

/* Hero区域需要充足留白 */
.hero {
  min-height: 100vh;
  padding-block: var(--space-32);
}
Bento网格模式(用于仪表盘):
css
.bento {
  display: grid;
  grid-template-columns: repeat(4, 1fr);
  grid-auto-rows: minmax(150px, auto);
  gap: var(--space-4);
}

/* 特色卡片跨度 */
.card-hero { grid-column: span 2; grid-row: span 2; }
.card-wide { grid-column: span 2; }
.card-tall { grid-row: span 2; }

Visual Effects Library

视觉特效库

1. Glassmorphism (The Right Way)

1. 玻璃态效果(正确实现方式)

css
.glass {
  background: rgba(255, 255, 255, 0.03);
  backdrop-filter: blur(12px);
  -webkit-backdrop-filter: blur(12px);
  border: 1px solid rgba(255, 255, 255, 0.08);
  border-radius: 12px;
}

/* Elevated glass (for modals, dropdowns) */
.glass-elevated {
  background: rgba(255, 255, 255, 0.05);
  backdrop-filter: blur(20px);
  border: 1px solid rgba(255, 255, 255, 0.1);
  box-shadow: 
    0 8px 32px rgba(0, 0, 0, 0.4),
    inset 0 1px 0 rgba(255, 255, 255, 0.05);
}
css
.glass {
  background: rgba(255, 255, 255, 0.03);
  backdrop-filter: blur(12px);
  -webkit-backdrop-filter: blur(12px);
  border: 1px solid rgba(255, 255, 255, 0.08);
  border-radius: 12px;
}

/* 增强版玻璃态(用于模态框、下拉菜单) */
.glass-elevated {
  background: rgba(255, 255, 255, 0.05);
  backdrop-filter: blur(20px);
  border: 1px solid rgba(255, 255, 255, 0.1);
  box-shadow: 
    0 8px 32px rgba(0, 0, 0, 0.4),
    inset 0 1px 0 rgba(255, 255, 255, 0.05);
}

2. CRT Scanlines Overlay

2. CRT扫描线叠加层

css
.scanlines::before {
  content: '';
  position: fixed;
  inset: 0;
  background: repeating-linear-gradient(
    0deg,
    rgba(0, 0, 0, 0.1) 0px,
    rgba(0, 0, 0, 0.1) 1px,
    transparent 1px,
    transparent 2px
  );
  pointer-events: none;
  z-index: 9999;
}
css
.scanlines::before {
  content: '';
  position: fixed;
  inset: 0;
  background: repeating-linear-gradient(
    0deg,
    rgba(0, 0, 0, 0.1) 0px,
    rgba(0, 0, 0, 0.1) 1px,
    transparent 1px,
    transparent 2px
  );
  pointer-events: none;
  z-index: 9999;
}

3. Film Grain Texture

3. 胶片颗粒纹理

css
.grain::before {
  content: '';
  position: fixed;
  inset: 0;
  opacity: 0.03;
  pointer-events: none;
  background-image: url("data:image/svg+xml,%3Csvg viewBox='0 0 256 256' xmlns='http://www.w3.org/2000/svg'%3E%3Cfilter id='noise'%3E%3CfeTurbulence type='fractalNoise' baseFrequency='0.8' numOctaves='4' stitchTiles='stitch'/%3E%3C/filter%3E%3Crect width='100%25' height='100%25' filter='url(%23noise)'/%3E%3C/svg%3E");
}
css
.grain::before {
  content: '';
  position: fixed;
  inset: 0;
  opacity: 0.03;
  pointer-events: none;
  background-image: url("data:image/svg+xml,%3Csvg viewBox='0 0 256 256' xmlns='http://www.w3.org/2000/svg'%3E%3Cfilter id='noise'%3E%3CfeTurbulence type='fractalNoise' baseFrequency='0.8' numOctaves='4' stitchTiles='stitch'/%3E%3C/filter%3E%3Crect width='100%25' height='100%25' filter='url(%23noise)'/%3E%3C/svg%3E");
}

4. Tech Grid Background

4. 科技网格背景

css
.tech-grid {
  background-image: 
    linear-gradient(rgba(255, 255, 255, 0.02) 1px, transparent 1px),
    linear-gradient(90deg, rgba(255, 255, 255, 0.02) 1px, transparent 1px);
  background-size: 60px 60px;
}
css
.tech-grid {
  background-image: 
    linear-gradient(rgba(255, 255, 255, 0.02) 1px, transparent 1px),
    linear-gradient(90deg, rgba(255, 255, 255, 0.02) 1px, transparent 1px);
  background-size: 60px 60px;
}

5. Neon Glow Effects

5. 霓虹发光效果

css
/* Text glow */
.neon-text {
  text-shadow: 
    0 0 10px currentColor,
    0 0 20px currentColor,
    0 0 40px currentColor,
    0 0 80px currentColor;
}

/* Box glow */
.neon-box {
  box-shadow: 
    0 0 20px var(--accent-alpha-40),
    0 0 40px var(--accent-alpha-20),
    inset 0 0 20px var(--accent-alpha-10);
}

/* Border glow */
.neon-border {
  border: 1px solid var(--accent);
  box-shadow: 
    0 0 10px var(--accent-alpha-50),
    inset 0 0 10px var(--accent-alpha-20);
}

css
/* 文本发光 */
.neon-text {
  text-shadow: 
    0 0 10px currentColor,
    0 0 20px currentColor,
    0 0 40px currentColor,
    0 0 80px currentColor;
}

/* 盒子发光 */
.neon-box {
  box-shadow: 
    0 0 20px var(--accent-alpha-40),
    0 0 40px var(--accent-alpha-20),
    inset 0 0 20px var(--accent-alpha-10);
}

/* 边框发光 */
.neon-border {
  border: 1px solid var(--accent);
  box-shadow: 
    0 0 10px var(--accent-alpha-50),
    inset 0 0 10px var(--accent-alpha-20);
}

Animation Patterns

动画模式

Philosophy

理念

  • Entrance animations: Use once, make them count
  • Micro-interactions: Subtle, fast (150-300ms)
  • Ambient motion: Infinite, very slow, non-distracting
  • Page transitions: Smooth, coordinated
  • 入场动画:仅使用一次,确保效果出彩
  • 微交互:微妙、快速(150-300ms)
  • 环境动画:无限循环、非常缓慢、不分散注意力
  • 页面过渡:流畅、协调

Choosing the Right Tool

工具选择指南

NeedUseWhy
Hover/focus statesCSSZero JS, instant
Simple entranceCSS keyframesLightweight
Layout animationsFramer Motion
layout
prop magic
Gesture-basedFramer MotionBuilt-in drag/pan
Scroll-triggeredGSAP ScrollTriggerMost powerful
Text splittingGSAP SplitTextIndustry standard
Complex timelinesGSAPPrecise control
SVG morphingGSAP MorphSVGNo alternative
Default to simpler solutions. Escalate complexity only when needed.
需求使用工具原因
悬停/聚焦状态CSS无需JS,即时响应
简单入场效果CSS关键帧轻量
布局动画Framer Motion
layout
属性的魔法效果
手势交互Framer Motion内置拖拽/平移功能
滚动触发动画GSAP ScrollTrigger功能最强大
文本拆分GSAP SplitText行业标准
复杂时间线GSAP精确控制
SVG变形GSAP MorphSVG无可替代
默认使用更简单的方案,仅在必要时升级复杂度。

CSS Keyframes Library

CSS关键帧库

css
@keyframes fade-up {
  from { opacity: 0; transform: translateY(20px); }
  to { opacity: 1; transform: translateY(0); }
}

@keyframes fade-in {
  from { opacity: 0; }
  to { opacity: 1; }
}

@keyframes scale-in {
  from { opacity: 0; transform: scale(0.95); }
  to { opacity: 1; transform: scale(1); }
}

@keyframes slide-in-right {
  from { opacity: 0; transform: translateX(20px); }
  to { opacity: 1; transform: translateX(0); }
}

@keyframes pulse-glow {
  0%, 100% { opacity: 1; }
  50% { opacity: 0.6; }
}

@keyframes float {
  0%, 100% { transform: translateY(0); }
  50% { transform: translateY(-10px); }
}

@keyframes rotate-slow {
  from { transform: rotate(0deg); }
  to { transform: rotate(360deg); }
}

@keyframes scan-line {
  0% { transform: translateY(-100%); }
  100% { transform: translateY(100vh); }
}
css
@keyframes fade-up {
  from { opacity: 0; transform: translateY(20px); }
  to { opacity: 1; transform: translateY(0); }
}

@keyframes fade-in {
  from { opacity: 0; }
  to { opacity: 1; }
}

@keyframes scale-in {
  from { opacity: 0; transform: scale(0.95); }
  to { opacity: 1; transform: scale(1); }
}

@keyframes slide-in-right {
  from { opacity: 0; transform: translateX(20px); }
  to { opacity: 1; transform: translateX(0); }
}

@keyframes pulse-glow {
  0%, 100% { opacity: 1; }
  50% { opacity: 0.6; }
}

@keyframes float {
  0%, 100% { transform: translateY(0); }
  50% { transform: translateY(-10px); }
}

@keyframes rotate-slow {
  from { transform: rotate(0deg); }
  to { transform: rotate(360deg); }
}

@keyframes scan-line {
  0% { transform: translateY(-100%); }
  100% { transform: translateY(100vh); }
}

Staggered Entrance Pattern

stagger入场模式

css
.stagger-container > * {
  opacity: 0;
  animation: fade-up 0.6s ease-out forwards;
}

.stagger-container > *:nth-child(1) { animation-delay: 0.1s; }
.stagger-container > *:nth-child(2) { animation-delay: 0.2s; }
.stagger-container > *:nth-child(3) { animation-delay: 0.3s; }
.stagger-container > *:nth-child(4) { animation-delay: 0.4s; }
.stagger-container > *:nth-child(5) { animation-delay: 0.5s; }
css
.stagger-container > * {
  opacity: 0;
  animation: fade-up 0.6s ease-out forwards;
}

.stagger-container > *:nth-child(1) { animation-delay: 0.1s; }
.stagger-container > *:nth-child(2) { animation-delay: 0.2s; }
.stagger-container > *:nth-child(3) { animation-delay: 0.3s; }
.stagger-container > *:nth-child(4) { animation-delay: 0.4s; }
.stagger-container > *:nth-child(5) { animation-delay: 0.5s; }

CSS-Only Patterns (Zero Dependencies)

纯CSS模式(无依赖)

css
/* View transition entrance (Chrome 111+, Safari 18+) */
@supports (view-transition-name: none) {
  .card {
    view-transition-name: card;
  }
  
  ::view-transition-old(card),
  ::view-transition-new(card) {
    animation-duration: 0.3s;
  }
}

/* Scroll-driven animations (Chrome 115+) */
@supports (animation-timeline: scroll()) {
  .parallax-bg {
    animation: parallax linear;
    animation-timeline: scroll();
  }
  
  @keyframes parallax {
    from { transform: translateY(0); }
    to { transform: translateY(-30%); }
  }
}

/* Hover with spring-like feel */
.spring-hover {
  transition: transform 0.4s cubic-bezier(0.34, 1.56, 0.64, 1);
}
.spring-hover:hover {
  transform: scale(1.05);
}

/* Glow pulse */
.glow-pulse {
  animation: glow-pulse 2s ease-in-out infinite;
}
@keyframes glow-pulse {
  0%, 100% { box-shadow: 0 0 20px var(--accent-alpha-40); }
  50% { box-shadow: 0 0 40px var(--accent-alpha-60); }
}
css
/* 视图过渡入场(Chrome 111+, Safari 18+) */
@supports (view-transition-name: none) {
  .card {
    view-transition-name: card;
  }
  
  ::view-transition-old(card),
  ::view-transition-new(card) {
    animation-duration: 0.3s;
  }
}

/* 滚动驱动动画(Chrome 115+) */
@supports (animation-timeline: scroll()) {
  .parallax-bg {
    animation: parallax linear;
    animation-timeline: scroll();
  }
  
  @keyframes parallax {
    from { transform: translateY(0); }
    to { transform: translateY(-30%); }
  }
}

/* 弹簧感悬停效果 */
.spring-hover {
  transition: transform 0.4s cubic-bezier(0.34, 1.56, 0.64, 1);
}
.spring-hover:hover {
  transform: scale(1.05);
}

/* 发光脉冲 */
.glow-pulse {
  animation: glow-pulse 2s ease-in-out infinite;
}
@keyframes glow-pulse {
  0%, 100% { box-shadow: 0 0 20px var(--accent-alpha-40); }
  50% { box-shadow: 0 0 40px var(--accent-alpha-60); }
}

GSAP Patterns (When You Need Power)

GSAP模式(需要强大功能时)

typescript
// Stagger entrance on scroll
gsap.from('.card', {
  scrollTrigger: {
    trigger: '.cards-section',
    start: 'top 80%',
  },
  y: 60,
  opacity: 0,
  duration: 0.8,
  stagger: 0.1,
  ease: 'power3.out',
});

// Text scramble effect
const scrambleText = (el: HTMLElement, text: string) => {
  const chars = '!<>-_\\/[]{}—=+*^?#';
  let iteration = 0;
  
  const interval = setInterval(() => {
    el.innerText = text
      .split('')
      .map((char, i) => 
        i < iteration ? char : chars[Math.floor(Math.random() * chars.length)]
      )
      .join('');
    
    if (iteration >= text.length) clearInterval(interval);
    iteration += 1/3;
  }, 30);
};

// Smooth parallax
gsap.to('.parallax-bg', {
  scrollTrigger: {
    scrub: 1,
  },
  y: '-30%',
  ease: 'none',
});
typescript
// 滚动触发的stagger入场
gsap.from('.card', {
  scrollTrigger: {
    trigger: '.cards-section',
    start: 'top 80%',
  },
  y: 60,
  opacity: 0,
  duration: 0.8,
  stagger: 0.1,
  ease: 'power3.out',
});

// 文本 scrambling 效果
const scrambleText = (el: HTMLElement, text: string) => {
  const chars = '!<>-_\\/[]{}—=+*^?#';
  let iteration = 0;
  
  const interval = setInterval(() => {
    el.innerText = text
      .split('')
      .map((char, i) => 
        i < iteration ? char : chars[Math.floor(Math.random() * chars.length)]
      )
      .join('');
    
    if (iteration >= text.length) clearInterval(interval);
    iteration += 1/3;
  }, 30);
};

// 平滑视差
gsap.to('.parallax-bg', {
  scrollTrigger: {
    scrub: 1,
  },
  y: '-30%',
  ease: 'none',
});

Framer Motion Patterns

Framer Motion模式

tsx
// Page transitions
<AnimatePresence mode="wait">
  <motion.div
    key={page}
    initial={{ opacity: 0, y: 20 }}
    animate={{ opacity: 1, y: 0 }}
    exit={{ opacity: 0, y: -20 }}
    transition={{ duration: 0.3 }}
  />
</AnimatePresence>

// Hover glow effect
<motion.div
  whileHover={{ 
    scale: 1.02,
    boxShadow: '0 0 30px rgba(255, 77, 0, 0.4)',
  }}
  transition={{ type: 'spring', stiffness: 300 }}
/>

// Stagger children
<motion.div
  initial="hidden"
  animate="visible"
  variants={{
    hidden: {},
    visible: { transition: { staggerChildren: 0.1 } },
  }}
>
  {items.map(item => (
    <motion.div
      key={item.id}
      variants={{
        hidden: { opacity: 0, y: 20 },
        visible: { opacity: 1, y: 0 },
      }}
    />
  ))}
</motion.div>

tsx
// 页面过渡
<AnimatePresence mode="wait">
  <motion.div
    key={page}
    initial={{ opacity: 0, y: 20 }}
    animate={{ opacity: 1, y: 0 }}
    exit={{ opacity: 0, y: -20 }}
    transition={{ duration: 0.3 }}
  />
</AnimatePresence>

// 悬停发光效果
<motion.div
  whileHover={{ 
    scale: 1.02,
    boxShadow: '0 0 30px rgba(255, 77, 0, 0.4)',
  }}
  transition={{ type: 'spring', stiffness: 300 }}
/>

// 子元素stagger动画
<motion.div
  initial="hidden"
  animate="visible"
  variants={{
    hidden: {},
    visible: { transition: { staggerChildren: 0.1 } },
  }}
>
  {items.map(item => (
    <motion.div
      key={item.id}
      variants={{
        hidden: { opacity: 0, y: 20 },
        visible: { opacity: 1, y: 0 },
      }}
    />
  ))}
</motion.div>

3D & WebGL Patterns

3D & WebGL模式

Tech Stack

技术栈

bash
npm install three @react-three/fiber @react-three/drei
bash
npm install three @react-three/fiber @react-three/drei

Basic Scene Setup

基础场景设置

tsx
import { Canvas } from '@react-three/fiber';
import { Stars, Float, MeshDistortMaterial } from '@react-three/drei';

const Scene = () => (
  <Canvas
    camera={{ position: [0, 0, 5], fov: 75 }}
    style={{ position: 'fixed', inset: 0, zIndex: -1 }}
  >
    <ambientLight intensity={0.2} />
    <pointLight position={[10, 10, 10]} color="#ff4d00" />
    <Stars radius={100} depth={50} count={3000} />
    {/* Your 3D content */}
  </Canvas>
);
tsx
import { Canvas } from '@react-three/fiber';
import { Stars, Float, MeshDistortMaterial } from '@react-three/drei';

const Scene = () => (
  <Canvas
    camera={{ position: [0, 0, 5], fov: 75 }}
    style={{ position: 'fixed', inset: 0, zIndex: -1 }}
  >
    <ambientLight intensity={0.2} />
    <pointLight position={[10, 10, 10]} color="#ff4d00" />
    <Stars radius={100} depth={50} count={3000} />
    {/* 你的3D内容 */}
  </Canvas>
);

Particle Sphere (Data Globe)

粒子球体(数据地球)

tsx
const ParticleSphere = ({ count = 3000, color = '#ff4d00' }) => {
  const ref = useRef<THREE.Points>(null);
  
  const positions = useMemo(() => {
    const pos = new Float32Array(count * 3);
    for (let i = 0; i < count; i++) {
      const theta = Math.random() * Math.PI * 2;
      const phi = Math.acos(Math.random() * 2 - 1);
      const r = 2;
      pos[i * 3] = r * Math.sin(phi) * Math.cos(theta);
      pos[i * 3 + 1] = r * Math.sin(phi) * Math.sin(theta);
      pos[i * 3 + 2] = r * Math.cos(phi);
    }
    return pos;
  }, [count]);
  
  useFrame(() => {
    if (ref.current) ref.current.rotation.y += 0.001;
  });
  
  return (
    <points ref={ref}>
      <bufferGeometry>
        <bufferAttribute
          attach="attributes-position"
          count={count}
          array={positions}
          itemSize={3}
        />
      </bufferGeometry>
      <pointsMaterial size={0.02} color={color} transparent opacity={0.8} />
    </points>
  );
};
tsx
const ParticleSphere = ({ count = 3000, color = '#ff4d00' }) => {
  const ref = useRef<THREE.Points>(null);
  
  const positions = useMemo(() => {
    const pos = new Float32Array(count * 3);
    for (let i = 0; i < count; i++) {
      const theta = Math.random() * Math.PI * 2;
      const phi = Math.acos(Math.random() * 2 - 1);
      const r = 2;
      pos[i * 3] = r * Math.sin(phi) * Math.cos(theta);
      pos[i * 3 + 1] = r * Math.sin(phi) * Math.sin(theta);
      pos[i * 3 + 2] = r * Math.cos(phi);
    }
    return pos;
  }, [count]);
  
  useFrame(() => {
    if (ref.current) ref.current.rotation.y += 0.001;
  });
  
  return (
    <points ref={ref}>
      <bufferGeometry>
        <bufferAttribute
          attach="attributes-position"
          count={count}
          array={positions}
          itemSize={3}
        />
      </bufferGeometry>
      <pointsMaterial size={0.02} color={color} transparent opacity={0.8} />
    </points>
  );
};

Sentient Core (AI Brain)

智能核心(AI大脑)

tsx
const SentientCore = () => (
  <Float speed={2} rotationIntensity={0.5}>
    <mesh>
      <sphereGeometry args={[1.5, 64, 64]} />
      <MeshDistortMaterial
        color="#00f3ff"
        wireframe
        distort={0.4}
        speed={2}
      />
    </mesh>
  </Float>
);
tsx
const SentientCore = () => (
  <Float speed={2} rotationIntensity={0.5}>
    <mesh>
      <sphereGeometry args={[1.5, 64, 64]} />
      <MeshDistortMaterial
        color="#00f3ff"
        wireframe
        distort={0.4}
        speed={2}
      />
    </mesh>
  </Float>
);

Performance Rules

性能规则

  1. Always use
    requestAnimationFrame
    via
    useFrame
  2. Reduce particle counts on mobile (check
    window.innerWidth
    )
  3. Use
    useMemo
    for geometry/position calculations
  4. Cleanup animations in
    useEffect
    return
  5. Set
    transparent
    and
    opacity
    for depth sorting

  1. 始终通过
    useFrame
    使用
    requestAnimationFrame
  2. 在移动端减少粒子数量(检查
    window.innerWidth
  3. 使用
    useMemo
    处理几何/位置计算
  4. useEffect
    的返回函数中清理动画
  5. 设置
    transparent
    opacity
    以实现深度排序

Component Patterns

组件模式

1. Loading + Page Transitions

1. 加载 + 页面过渡

Default (ship this unless user asks otherwise):
  • Skeleton placeholders on cards/sections (see shimmer pattern above)
  • Simple fade/slide page transition using CSS or Framer Motion route transitions
Optional Cinematic Mode (only when the user wants a narrative boot sequence and there's time/budget):
  • GSAP-powered preloader with boot logs, text scramble, shader/WebGL background
  • Coordinated timeline that fades into actual content once data is ready
默认方案(除非用户要求否则使用此方案):
  • 卡片/区块使用骨架屏占位(参考上方的shimmer模式)
  • 使用CSS或Framer Motion路由过渡实现简单的淡入/滑入页面过渡
可选电影模式(仅当用户需要叙事性启动序列且有时间/预算时):
  • 使用GSAP实现带有启动日志、文本scramble、着色器/WebGL背景的预加载器
  • 协调时间线,在数据加载完成后淡入实际内容

2. Glassmorphic Navbar

2. 玻璃态导航栏

tsx
<nav className="fixed top-4 left-1/2 -translate-x-1/2 z-50">
  <div className="glass rounded-full px-6 py-3 flex items-center gap-8">
    <Logo />
    <NavLinks />
    <ThemeToggle />
    <CTA />
  </div>
</nav>
tsx
<nav className="fixed top-4 left-1/2 -translate-x-1/2 z-50">
  <div className="glass rounded-full px-6 py-3 flex items-center gap-8">
    <Logo />
    <NavLinks />
    <ThemeToggle />
    <CTA />
  </div>
</nav>

3. Live Terminal

3. 实时终端

tsx
const Terminal = ({ logs }) => {
  const scrollRef = useRef();
  
  useEffect(() => {
    scrollRef.current?.scrollTo(0, scrollRef.current.scrollHeight);
  }, [logs]);
  
  return (
    <div className="glass font-mono text-xs">
      <header className="border-b border-white/10 px-4 py-2">
        <span className="text-accent">&gt;</span> System Logs
        <span className="ml-auto w-2 h-2 bg-green-500 rounded-full animate-pulse" />
      </header>
      <div ref={scrollRef} className="h-64 overflow-y-auto p-4">
        {logs.map(log => (
          <div key={log.id}>
            <span className="text-zinc-600">{log.time}</span>
            <span className={levelColor[log.level]}>[{log.level}]</span>
            <span>{log.message}</span>
          </div>
        ))}
      </div>
    </div>
  );
};
tsx
const Terminal = ({ logs }) => {
  const scrollRef = useRef();
  
  useEffect(() => {
    scrollRef.current?.scrollTo(0, scrollRef.current.scrollHeight);
  }, [logs]);
  
  return (
    <div className="glass font-mono text-xs">
      <header className="border-b border-white/10 px-4 py-2">
        <span className="text-accent">&gt;</span> System Logs
        <span className="ml-auto w-2 h-2 bg-green-500 rounded-full animate-pulse" />
      </header>
      <div ref={scrollRef} className="h-64 overflow-y-auto p-4">
        {logs.map(log => (
          <div key={log.id}>
            <span className="text-zinc-600">{log.time}</span>
            <span className={levelColor[log.level]}>[{log.level}]</span>
            <span>{log.message}</span>
          </div>
        ))}
      </div>
    </div>
  );
};

4. Stat Cards with Sparklines

4. 带迷你折线图的统计卡片

tsx
const StatCard = ({ icon, label, value, change, trend }) => (
  <motion.div
    whileHover={{ scale: 1.02, boxShadow: '0 0 30px var(--accent-alpha-30)' }}
    className="glass p-4"
  >
    <div className="flex justify-between">
      <div className="p-2 rounded-lg bg-accent/10 text-accent">{icon}</div>
      <span className={change > 0 ? 'text-green-400' : 'text-red-400'}>
        {change > 0 ? '+' : ''}{change}%
      </span>
    </div>
    <div className="mt-4 font-mono text-2xl font-bold">{value}</div>
    <div className="text-xs text-zinc-500 uppercase">{label}</div>
    <Sparkline data={trend} className="mt-2 h-8" />
  </motion.div>
);

tsx
const StatCard = ({ icon, label, value, change, trend }) => (
  <motion.div
    whileHover={{ scale: 1.02, boxShadow: '0 0 30px var(--accent-alpha-30)' }}
    className="glass p-4"
  >
    <div className="flex justify-between">
      <div className="p-2 rounded-lg bg-accent/10 text-accent">{icon}</div>
      <span className={change > 0 ? 'text-green-400' : 'text-red-400'}>
        {change > 0 ? '+' : ''}{change}%
      </span>
    </div>
    <div className="mt-4 font-mono text-2xl font-bold">{value}</div>
    <div className="text-xs text-zinc-500 uppercase">{label}</div>
    <Sparkline data={trend} className="mt-2 h-8" />
  </motion.div>
);

Quality Checklist

质量检查清单

Before shipping, verify:
上线前需验证:

Visual

视觉

  • Dark mode is default and premium-feeling
  • ONE dominant accent color used consistently
  • Glass effects have proper blur AND borders
  • Scanlines or grain overlay for texture
  • No pure white text on dark (#f4f4f5 max)
  • 深色模式为默认且质感高端
  • 一种主导强调色使用一致
  • 玻璃效果同时具备模糊和边框
  • 扫描线或颗粒叠加层增加质感
  • 深色背景上无纯白色文本(最大使用#f4f4f5)

Typography

排版

  • Display font for headlines (not Inter/Roboto)
  • Monospace for ALL data/code/numbers
  • Proper hierarchy (3-4 distinct levels)
  • Tracking adjusted for large text
  • 标题使用展示字体(非Inter/Roboto)
  • 所有数据/代码/数字使用等宽字体
  • 清晰的层级结构(3-4个不同层级)
  • 大文本调整了字间距

Animation

动画

  • Entrance animations on load (staggered)
  • Hover states with transform AND glow
  • Smooth 60fps for all canvas
  • No animation without purpose
  • 页面加载时使用入场动画(staggered)
  • 悬停状态同时包含变换和发光效果
  • 所有canvas保持60fps流畅
  • 无无意义的动画

Code

代码

  • CSS variables for all colors
  • Responsive (mobile-first)
  • Cleanup functions in useEffect
  • Error boundaries for 3D content

  • 所有颜色使用CSS变量
  • 响应式设计(移动端优先)
  • useEffect中包含清理函数
  • 3D内容添加了错误边界

Accessibility (Premium ≠ Inaccessible)

无障碍设计(高端≠不可访问)

Great design is inclusive. These aren't optional.
优秀的设计具有包容性,以下内容为必填项。

Motion Sensitivity

动画敏感性

css
/* ALWAYS respect user preferences */
@media (prefers-reduced-motion: reduce) {
  *, *::before, *::after {
    animation-duration: 0.01ms !important;
    animation-iteration-count: 1 !important;
    transition-duration: 0.01ms !important;
  }
}
tsx
// React hook for motion preference
const usePrefersReducedMotion = () => {
  const [prefersReduced, setPrefersReduced] = useState(false);
  
  useEffect(() => {
    const mq = window.matchMedia('(prefers-reduced-motion: reduce)');
    setPrefersReduced(mq.matches);
    const handler = (e: MediaQueryListEvent) => setPrefersReduced(e.matches);
    mq.addEventListener('change', handler);
    return () => mq.removeEventListener('change', handler);
  }, []);
  
  return prefersReduced;
};

// Usage
const shouldAnimate = !usePrefersReducedMotion();
css
/* 始终尊重用户偏好 */
@media (prefers-reduced-motion: reduce) {
  *, *::before, *::after {
    animation-duration: 0.01ms !important;
    animation-iteration-count: 1 !important;
    transition-duration: 0.01ms !important;
  }
}
tsx
// 用于检测动画偏好的React Hook
const usePrefersReducedMotion = () => {
  const [prefersReduced, setPrefersReduced] = useState(false);
  
  useEffect(() => {
    const mq = window.matchMedia('(prefers-reduced-motion: reduce)');
    setPrefersReduced(mq.matches);
    const handler = (e: MediaQueryListEvent) => setPrefersReduced(e.matches);
    mq.addEventListener('change', handler);
    return () => mq.removeEventListener('change', handler);
  }, []);
  
  return prefersReduced;
};

// 使用示例
const shouldAnimate = !usePrefersReducedMotion();

WebGL Accessibility

WebGL无障碍

tsx
// Always mark decorative 3D as hidden
<div aria-hidden="true" className="pointer-events-none">
  <Canvas>{/* decorative background */}</Canvas>
</div>

// Provide text alternatives for meaningful 3D
<div role="img" aria-label="3D visualization of global network connections">
  <Canvas>{/* data visualization */}</Canvas>
</div>
tsx
// 始终将装饰性3D元素标记为隐藏
<div aria-hidden="true" className="pointer-events-none">
  <Canvas>{/* 装饰性背景 */}</Canvas>
</div>

// 为有意义的3D内容提供文本替代
<div role="img" aria-label="全球网络连接的3D可视化">
  <Canvas>{/* 数据可视化 */}</Canvas>
</div>

Color Contrast

色彩对比度

ElementMinimum RatioTarget
Body text4.5:17:1
Large text (18px+)3:14.5:1
UI components3:14.5:1
DecorativeN/AN/A
css
/* Safe text colors on dark backgrounds */
--text-primary: #ffffff;     /* ✓ 21:1 on #000 */
--text-secondary: #a1a1aa;   /* ✓ 7.2:1 on #000 */
--text-muted: #71717a;       /* ✓ 4.6:1 on #000 */
--text-ghost: #52525b;       /* ⚠ 3.2:1 - decorative only */
元素最小对比度目标值
正文文本4.5:17:1
大文本(18px+)3:14.5:1
UI组件3:14.5:1
装饰元素无要求无要求
css
/* 深色背景上的安全文本颜色 */
--text-primary: #ffffff;     /* ✓ 21:1 on #000 */
--text-secondary: #a1a1aa;   /* ✓ 7.2:1 on #000 */
--text-muted: #71717a;       /* ✓ 4.6:1 on #000 */
--text-ghost: #52525b;       /* ⚠ 3.2:1 - 仅用于装饰 */

Keyboard Navigation

键盘导航

tsx
// Interactive 3D elements need keyboard support
<mesh
  tabIndex={0}
  onKeyDown={(e) => e.key === 'Enter' && handleClick()}
  onClick={handleClick}
/>

// Focus indicators for glass components
.glass:focus-visible {
  outline: 2px solid var(--accent);
  outline-offset: 2px;
}

tsx
// 交互式3D元素需要支持键盘操作
<mesh
  tabIndex={0}
  onKeyDown={(e) => e.key === 'Enter' && handleClick()}
  onClick={handleClick}
/>

// 玻璃组件的焦点指示器
.glass:focus-visible {
  outline: 2px solid var(--accent);
  outline-offset: 2px;
}

Mobile & Responsive Strategy

移动端与响应式策略

Premium experiences adapt gracefully. Don't just shrink — reimagine.
高端体验需优雅适配,不要仅做缩放——要重新设计。

WebGL Fallbacks

WebGL降级方案

tsx
// Detect low-power devices
const useIsLowPowerDevice = () => {
  const [isLowPower, setIsLowPower] = useState(false);
  
  useEffect(() => {
    const isLow = 
      window.innerWidth < 768 ||
      navigator.hardwareConcurrency <= 4 ||
      /Android|iPhone|iPad/.test(navigator.userAgent);
    setIsLowPower(isLow);
  }, []);
  
  return isLowPower;
};

// Usage in hero components
const HeroBackground = () => {
  const isLowPower = useIsLowPowerDevice();
  
  if (isLowPower) {
    return <CSSGradientFallback />; // Lighter alternative
  }
  
  return <WebGLBackground />;
};
tsx
// 检测低性能设备
const useIsLowPowerDevice = () => {
  const [isLowPower, setIsLowPower] = useState(false);
  
  useEffect(() => {
    const isLow = 
      window.innerWidth < 768 ||
      navigator.hardwareConcurrency <= 4 ||
      /Android|iPhone|iPad/.test(navigator.userAgent);
    setIsLowPower(isLow);
  }, []);
  
  return isLowPower;
};

// 在Hero组件中使用
const HeroBackground = () => {
  const isLowPower = useIsLowPowerDevice();
  
  if (isLowPower) {
    return <CSSGradientFallback />; // 更轻量的替代方案
  }
  
  return <WebGLBackground />;
};

Performance Budgets

性能预算

DeviceJS BudgetAnimation Target
Desktop< 500KB60fps WebGL
Tablet< 300KB30fps or CSS-only
Mobile< 150KBCSS-only, no WebGL
设备JS预算动画目标
桌面端< 500KB60fps WebGL
平板端< 300KB30fps或纯CSS动画
移动端< 150KB纯CSS动画,无WebGL

Touch Interactions

触摸交互

tsx
// Replace hover with tap/long-press on mobile
<motion.div
  whileHover={{ scale: 1.02 }}  // Desktop
  whileTap={{ scale: 0.98 }}    // Mobile
  onTouchStart={handleTouch}
/>

// Increase touch targets
.button {
  min-height: 44px;  /* Apple HIG */
  min-width: 44px;
  padding: 12px 24px;
}
tsx
// 移动端将悬停替换为点击/长按
<motion.div
  whileHover={{ scale: 1.02 }}  // 桌面端
  whileTap={{ scale: 0.98 }}    // 移动端
  onTouchStart={handleTouch}
/>

// 增大触摸目标区域
.button {
  min-height: 44px;  /* Apple人机交互指南 */
  min-width: 44px;
  padding: 12px 24px;
}

Responsive Typography

响应式排版

css
/* Fluid type scale */
--text-hero: clamp(2.5rem, 8vw, 7rem);
--text-h1: clamp(2rem, 5vw, 4rem);
--text-h2: clamp(1.5rem, 3vw, 2.5rem);
--text-body: clamp(1rem, 2vw, 1.125rem);

/* Reduce letter-spacing on mobile */
@media (max-width: 768px) {
  .headline {
    letter-spacing: -0.02em; /* Less aggressive than desktop */
  }
}

css
/* 流体字体刻度 */
--text-hero: clamp(2.5rem, 8vw, 7rem);
--text-h1: clamp(2rem, 5vw, 4rem);
--text-h2: clamp(1.5rem, 3vw, 2.5rem);
--text-body: clamp(1rem, 2vw, 1.125rem);

/* 移动端减少字间距 */
@media (max-width: 768px) {
  .headline {
    letter-spacing: -0.02em; /* 比桌面端更宽松 */
  }
}

Loading & Error States

加载与错误状态

Premium UX handles every state beautifully.
高端UX需完美处理每一种状态。

Skeleton Loaders

骨架屏加载器

tsx
// Glass skeleton with shimmer
const Skeleton = ({ className }: { className?: string }) => (
  <div 
    className={`relative overflow-hidden rounded-lg bg-white/5 ${className}`}
  >
    <div 
      className="absolute inset-0 -translate-x-full animate-[shimmer_2s_infinite] bg-gradient-to-r from-transparent via-white/10 to-transparent"
    />
  </div>
);

// Usage
<div className="space-y-4">
  <Skeleton className="h-8 w-3/4" />
  <Skeleton className="h-4 w-full" />
  <Skeleton className="h-4 w-5/6" />
</div>
css
@keyframes shimmer {
  100% { transform: translateX(100%); }
}
tsx
// 带shimmer效果的玻璃态骨架屏
const Skeleton = ({ className }: { className?: string }) => (
  <div 
    className={`relative overflow-hidden rounded-lg bg-white/5 ${className}`}
  >
    <div 
      className="absolute inset-0 -translate-x-full animate-[shimmer_2s_infinite] bg-gradient-to-r from-transparent via-white/10 to-transparent"
    />
  </div>
);

// 使用示例
<div className="space-y-4">
  <Skeleton className="h-8 w-3/4" />
  <Skeleton className="h-4 w-full" />
  <Skeleton className="h-4 w-5/6" />
</div>
css
@keyframes shimmer {
  100% { transform: translateX(100%); }
}

Error Boundaries (Styled)

错误边界(带样式)

tsx
const ErrorFallback = ({ error, resetErrorBoundary }) => (
  <div className="glass p-8 text-center">
    <div className="mx-auto mb-4 h-16 w-16 rounded-full bg-red-500/10 flex items-center justify-center">
      <AlertTriangle className="h-8 w-8 text-red-400" />
    </div>
    <h2 className="text-xl font-semibold text-white mb-2">
      Something went wrong
    </h2>
    <p className="text-zinc-400 mb-4 font-mono text-sm">
      {error.message}
    </p>
    <button 
      onClick={resetErrorBoundary}
      className="px-4 py-2 bg-white/10 rounded-lg hover:bg-white/20 transition"
    >
      Try again
    </button>
  </div>
);
tsx
const ErrorFallback = ({ error, resetErrorBoundary }) => (
  <div className="glass p-8 text-center">
    <div className="mx-auto mb-4 h-16 w-16 rounded-full bg-red-500/10 flex items-center justify-center">
      <AlertTriangle className="h-8 w-8 text-red-400" />
    </div>
    <h2 className="text-xl font-semibold text-white mb-2">
      出现错误
    </h2>
    <p className="text-zinc-400 mb-4 font-mono text-sm">
      {error.message}
    </p>
    <button 
      onClick={resetErrorBoundary}
      className="px-4 py-2 bg-white/10 rounded-lg hover:bg-white/20 transition"
    >
      重试
    </button>
  </div>
);

Empty States

空状态

tsx
const EmptyState = ({ 
  icon: Icon, 
  title, 
  description, 
  action 
}: EmptyStateProps) => (
  <div className="flex flex-col items-center justify-center py-16 text-center">
    <div className="mb-4 rounded-full bg-white/5 p-4">
      <Icon className="h-8 w-8 text-zinc-500" />
    </div>
    <h3 className="text-lg font-medium text-white mb-1">{title}</h3>
    <p className="text-zinc-400 mb-4 max-w-sm">{description}</p>
    {action}
  </div>
);

// Usage
<EmptyState
  icon={Inbox}
  title="No messages yet"
  description="When you receive messages, they'll appear here."
  action={<Button>Send your first message</Button>}
/>
tsx
const EmptyState = ({ 
  icon: Icon, 
  title, 
  description, 
  action 
}: EmptyStateProps) => (
  <div className="flex flex-col items-center justify-center py-16 text-center">
    <div className="mb-4 rounded-full bg-white/5 p-4">
      <Icon className="h-8 w-8 text-zinc-500" />
    </div>
    <h3 className="text-lg font-medium text-white mb-1">{title}</h3>
    <p className="text-zinc-400 mb-4 max-w-sm">{description}</p>
    {action}
  </div>
);

// 使用示例
<EmptyState
  icon={Inbox}
  title="暂无消息"
  description="收到消息后将显示在这里。"
  action={<Button>发送第一条消息</Button>}
/>

Loading States for Data

数据加载状态

tsx
// Optimistic UI with rollback
const [items, setItems] = useState(data);
const [pending, startTransition] = useTransition();

const addItem = (newItem) => {
  // Optimistic update
  setItems(prev => [...prev, { ...newItem, pending: true }]);
  
  startTransition(async () => {
    try {
      await api.createItem(newItem);
    } catch {
      // Rollback on error
      setItems(prev => prev.filter(i => i.id !== newItem.id));
      toast.error('Failed to add item');
    }
  });
};

tsx
// 乐观UI与回滚
const [items, setItems] = useState(data);
const [pending, startTransition] = useTransition();

const addItem = (newItem) => {
  // 乐观更新
  setItems(prev => [...prev, { ...newItem, pending: true }]);
  
  startTransition(async () => {
    try {
      await api.createItem(newItem);
    } catch {
      // 错误时回滚
      setItems(prev => prev.filter(i => i.id !== newItem.id));
      toast.error('添加项目失败');
    }
  });
};

Framework Integration

框架集成

Next.js App Router

Next.js App Router

tsx
// Client boundary for WebGL components
// app/components/hero-client.tsx
'use client';

import dynamic from 'next/dynamic';

// Lazy load heavy 3D components
const WebGLHero = dynamic(() => import('./webgl-hero'), {
  ssr: false,
  loading: () => <HeroSkeleton />,
});

export default function HeroClient() {
  return <WebGLHero />;
}
tsx
// Server component wrapper
// app/page.tsx
import HeroClient from './components/hero-client';

export default function Page() {
  return (
    <main>
      {/* Server-rendered SEO content */}
      <h1 className="sr-only">Your SEO Title</h1>
      
      {/* Client-side 3D hero */}
      <HeroClient />
    </main>
  );
}
tsx
// WebGL组件的客户端边界
// app/components/hero-client.tsx
'use client';

import dynamic from 'next/dynamic';

// 懒加载重型3D组件
const WebGLHero = dynamic(() => import('./webgl-hero'), {
  ssr: false,
  loading: () => <HeroSkeleton />,
});

export default function HeroClient() {
  return <WebGLHero />;
}
tsx
// 服务器组件包装器
// app/page.tsx
import HeroClient from './components/hero-client';

export default function Page() {
  return (
    <main>
      {/* 服务器渲染的SEO内容 */}
      <h1 className="sr-only">你的SEO标题</h1>
      
      {/* 客户端3D Hero */}
      <HeroClient />
    </main>
  );
}

SEO for WebGL Content

WebGL内容的SEO

tsx
// WebGL isn't crawlable - always provide text alternatives
<section aria-labelledby="hero-title">
  {/* Hidden but crawlable */}
  <h1 id="hero-title" className="sr-only">
    AI-Powered Trading Platform
  </h1>
  <p className="sr-only">
    {seoDescription}
  </p>
  
  {/* Visual hero (not crawled) */}
  <div aria-hidden="true">
    <Canvas>...</Canvas>
  </div>
  
  {/* Visible text (crawled) */}
  <div className="relative z-10">
    <span className="text-7xl">{visibleTitle}</span>
  </div>
</section>
tsx
// WebGL无法被爬虫抓取 - 始终提供文本替代
<section aria-labelledby="hero-title">
  {/* 隐藏但可被爬虫抓取 */}
  <h1 id="hero-title" className="sr-only">
    AI驱动的交易平台
  </h1>
  <p className="sr-only">
    {seoDescription}
  </p>
  
  {/* 视觉Hero(不被爬虫抓取) */}
  <div aria-hidden="true">
    <Canvas>...</Canvas>
  </div>
  
  {/* 可见文本(可被爬虫抓取) */}
  <div className="relative z-10">
    <span className="text-7xl">{visibleTitle}</span>
  </div>
</section>

Data Fetching with Loading States

带加载状态的数据获取

tsx
// Server Component with Suspense
import { Suspense } from 'react';

async function DashboardData() {
  const data = await fetchDashboardData();
  return <DashboardWidgets data={data} />;
}

export default function Dashboard() {
  return (
    <div className="bento-grid">
      <Suspense fallback={<WidgetSkeleton />}>
        <DashboardData />
      </Suspense>
    </div>
  );
}

tsx
// 带Suspense的服务器组件
import { Suspense } from 'react';

async function DashboardData() {
  const data = await fetchDashboardData();
  return <DashboardWidgets data={data} />;
}

export default function Dashboard() {
  return (
    <div className="bento-grid">
      <Suspense fallback={<WidgetSkeleton />}>
        <DashboardData />
      </Suspense>
    </div>
  );
}

Template Quick Reference

模板快速参考

TemplatePropsWebGLMobile FallbackBest Animation Lib
cppn-hero
title
,
description
,
ctaButtons
,
microDetails
YesCSS gradientGSAP (SplitText)
mesh-gradient-hero
colors[]
,
speed
,
distortion
,
swirl
No*NativeFramer Motion
wave-hero
title
,
subtitle
,
placeholder
,
onPromptSubmit
YesSolid bgGSAP
globe-hero
globeImage
,
dashboardImage
,
accentColor
NoNativeFramer Motion
hero-section
title
,
badge
,
primaryCTA
,
accentColor
YesStars CSSEither
bento-grid
children
(card layout)
NoNativeCSS or Framer
dashboard-widgets
value
,
change
,
trend[]
NoNativeFramer Motion
terminal
logs[]
,
title
NoNativeCSS
preloader
onComplete
,
messages[]
OptionalCSS versionGSAP
glass-components
VariousNoNativeCSS
*
mesh-gradient-hero
uses
@paper-design/shaders-react
(Canvas, not WebGL)

模板属性WebGL支持移动端降级最佳动画库
cppn-hero
title
,
description
,
ctaButtons
,
microDetails
CSS渐变GSAP(SplitText)
mesh-gradient-hero
colors[]
,
speed
,
distortion
,
swirl
否*原生CSSFramer Motion
wave-hero
title
,
subtitle
,
placeholder
,
onPromptSubmit
纯色背景GSAP
globe-hero
globeImage
,
dashboardImage
,
accentColor
原生CSSFramer Motion
hero-section
title
,
badge
,
primaryCTA
,
accentColor
Stars CSS均可
bento-grid
children
(卡片布局)
原生CSSCSS或Framer
dashboard-widgets
value
,
change
,
trend[]
原生CSSFramer Motion
terminal
logs[]
,
title
原生CSSCSS
preloader
onComplete
,
messages[]
可选CSS版本GSAP
glass-components
多种原生CSSCSS
*
mesh-gradient-hero
使用
@paper-design/shaders-react
(Canvas,非WebGL)

Template Playbooks (Start Grounded, Layer Wow Intentionally)

模板使用手册(从基础开始,逐步添加惊艳效果)

GoalBaseline (Clarity-first)Optional Wow UpgradeKill It If
Marketing / Waitlist
mesh-gradient-hero
+
glass-components
+
bento-grid
value props
Swap hero for
cppn-hero
or add
wave-hero
band for social proof
Copy is long-form or the product is compliance-heavy
AI / Research Landing
cppn-hero
+
dashboard-widgets
(metrics) +
terminal
logs
Add
holographic
shader sections or
globe-hero
interlude
User needs print-friendly deliverables
Crypto / Finance
globe-hero
+
bento-grid
KPIs +
dashboard-widgets
+ CTA strip
Add
data-grid
shader background or rolling ticker
Performance budget < 200KB or mobile-only
Developer Tools
wave-hero
+
terminal
+
glass-components
cards
Introduce
digital-liquid
shader or 3D device mock
Audience is enterprise buyers needing conservative tone
Product Dashboard
bento-grid
+
dashboard-widgets
+
mesh-gradient-hero
(static)
Add mini WebGL module (sentient core, particle globe)Data is dense, requires tabular clarity
目标基线(清晰优先)可选惊艳升级需避免场景
营销/等待列表
mesh-gradient-hero
+
glass-components
+
bento-grid
价值主张
将Hero替换为
cppn-hero
或添加
wave-hero
区域展示社交证明
内容为长文本或产品需合规严谨
AI/研究着陆页
cppn-hero
+
dashboard-widgets
(指标) +
terminal
日志
添加
holographic
着色器区域或
globe-hero
过渡
用户需要可打印的交付物
加密货币/金融
globe-hero
+
bento-grid
关键指标 +
dashboard-widgets
+ CTA条
添加
data-grid
着色器背景或滚动行情
性能预算<200KB或仅面向移动端
开发者工具
wave-hero
+
terminal
+
glass-components
卡片
引入
digital-liquid
着色器或3D设备模型
受众为企业买家需要保守风格
产品仪表盘
bento-grid
+
dashboard-widgets
+
mesh-gradient-hero
(静态)
添加小型WebGL模块(智能核心、粒子地球)数据密集,需要表格清晰度

Layout Flow Recipes

布局流程示例

  1. Hero (signature flourish) → Key metrics/value props (calm) → Product proof (screens) → Testimonials/logos → CTA (glow button).
  2. Dashboard page: Above-the-fold summary (minimal) → Feature grid (asymmetrical) → Live data (terminal/sparkline) → Help/resources (calm).
  3. Docs/Platform: Clean header (
    mesh-gradient-hero
    in CSS mode) → Navigation grid → Content area (monospace) → CTA.
Each flow should have at most two high-saturation panels. If you need more energy, animate the CTA or accent borders instead of adding another shader.

  1. Hero(标志性亮点) → 关键指标/价值主张(简洁)→ 产品展示(截图)→ 客户见证/Logo → CTA(发光按钮)。
  2. 仪表盘页面:首屏摘要(极简)→ 功能网格(不对称)→ 实时数据(终端/迷你折线图)→ 帮助/资源(简洁)。
  3. 文档/平台:简洁头部(CSS模式的mesh-gradient-hero)→ 导航网格 → 内容区域(等宽字体)→ CTA。
每个流程最多包含两个高饱和度区块。如果需要更多活力,可动画化CTA或强调边框,而非添加另一个着色器。

Template Remix & Adaptation Patterns

模板 remix 与适配模式

NeedActionNotes
Downgrade WebGL → CSSReplace
cppn-hero
with
mesh-gradient-hero
, keep same copy. Swap shader backgrounds for
bg-gradient-to-b
.
Use when user mentions “mobile-first,” “performance,” or “lightweight.”
Upgrade CSS → WebGLStart from
mesh-gradient-hero
, then inject
ShaderBackground
and reuse props from
cppn-hero
.
Only after confirming the client wants “cinematic” or “experimental.”
Shader swapAny hero using shaders can switch to another by swapping imports (e.g.,
holographic
digital-liquid
). Keep uniform names consistent.
Document the new accent palette alongside the swap.
Content density modeWhen the design needs to carry lots of text, keep hero flourish but make every subsequent section
bg-black
with simple borders.
Example:
cppn-hero
on top, then
bento-grid
in plain glass cards.
Prompt-to-template defaults- “Clean SaaS” → Mesh gradient package<br> - “AI platform” → CPPN hero + dashboard metrics<br> - “Crypto trading” → Globe hero + ticker<br> - “Developer CLI” → Wave hero + terminalMention these defaults directly in responses so the model doesn’t hallucinate new structures.
When in doubt: start with the baseline, ship usable layout, then pitch a single wow upgrade as a follow-up suggestion (“Optionally we can swap in the CPPN shader if you want a more neural vibe.”).

需求操作注意事项
WebGL降级为CSS
cppn-hero
替换为
mesh-gradient-hero
,保留相同文案。将着色器背景替换为
bg-gradient-to-b
当用户提及“移动端优先”、“性能”或“轻量”时使用。
CSS升级为WebGL
mesh-gradient-hero
开始,然后注入
ShaderBackground
并复用
cppn-hero
的属性。
仅在确认客户需要“电影级”或“实验性”效果后进行。
着色器替换任何使用着色器的Hero都可通过替换导入切换(例如
holographic
digital-liquid
)。保持uniform名称一致。
替换时记录新的强调色板。
内容密度模式当设计需要承载大量文本时,保留Hero亮点,但后续每个区块使用
bg-black
搭配简单边框。
示例:顶部使用
cppn-hero
,后续使用纯玻璃卡片的
bento-grid
提示到模板的默认映射- “Clean SaaS” → 网格渐变包<br> - “AI平台” → CPPN hero + 仪表盘指标<br> - “加密交易” → Globe hero + 行情<br> - “开发者CLI” → Wave hero + 终端在响应中直接提及这些默认值,避免模型生成新结构。
存疑时:从基线开始,交付可用布局,然后作为后续建议提出一个惊艳升级(例如:“可选方案是我们可以替换为CPPN着色器,营造更具神经网络风格的氛围。”)。

Template & Shader Selection Guide

模板与着色器选择指南

Use this guide to pick the right template and shader based on the user's request. Don't default to the same hero for everything — match the aesthetic to the domain.
根据用户请求选择合适的模板和着色器。不要默认使用相同的Hero——将美学风格与领域匹配。

Industry/Vertical Mapping

行业/领域映射

IndustryHero TemplateShaderAccent ColorTone
AI/ML/Neural
cppn-hero
cppn-generative
Cyan
#00f3ff
/ Purple
#a855f7
Organic, alive, mathematical
Crypto/DeFi/Trading
globe-hero
data-grid
Purple
#9b87f5
/ Amber
#f59e0b
Global, technical, financial
Developer Tools/API
wave-hero
digital-liquid
Blue
#1f3dbc
/ Orange
#ff4d00
Technical, dynamic, builder
SaaS/B2B/Product
mesh-gradient-hero
(CSS only)Soft pastelsClean, professional, trustworthy
Creative Agency
hero-section
(CyberpunkHero)
holographic
Neon colorsBold, experimental, artistic
Fintech/Dashboard
bento-grid
+
dashboard-widgets
data-grid
Green
#10b981
/ Blue
#3b82f6
Data-rich, precise, analytical
行业Hero模板着色器强调色风格基调
AI/ML/神经网络
cppn-hero
cppn-generative
青色
#00f3ff
/ 紫色
#a855f7
有机、鲜活、数学感
加密货币/DeFi/交易
globe-hero
data-grid
紫色
#9b87f5
/ 琥珀色
#f59e0b
全球化、技术感、金融精确
开发者工具/API
wave-hero
digital-liquid
蓝色
#1f3dbc
/ 橙色
#ff4d00
技术感、动态、开发者友好
SaaS/B2B/产品
mesh-gradient-hero
(仅CSS)柔和马卡龙色简洁、专业、值得信赖
创意机构
hero-section
(赛博朋克Hero)
holographic
霓虹色大胆、实验性、艺术性
金融科技/仪表盘
bento-grid
+
dashboard-widgets
data-grid
绿色
#10b981
/ 蓝色
#3b82f6
数据密集、精确、分析性

Keyword-Based Selection

关键词选择

When analyzing user requests, match keywords to templates:
User Request Analysis:
├── Contains "AI", "neural", "intelligent", "learning", "model", "GPT"
│   → cppn-hero + cppn-generative shader
│   → Organic, flowing backgrounds that feel "alive"
├── Contains "crypto", "blockchain", "trading", "global", "DeFi", "web3"
│   → globe-hero + data-grid shader
│   → Earth imagery, global reach, financial precision
├── Contains "developer", "API", "code", "build", "deploy", "ship"
│   → wave-hero + digital-liquid shader
│   → Dynamic bars, typing animations, terminal aesthetic
├── Contains "SaaS", "product", "waitlist", "brand", "startup", "launch"
│   → mesh-gradient-hero (no WebGL needed)
│   → Soft, fluid gradients, professional feel
├── Contains "futuristic", "cyber", "agency", "creative", "portfolio"
│   → hero-section (CyberpunkHero) + holographic shader
│   → Particle spheres, text scramble, scanlines
└── Contains "dashboard", "analytics", "metrics", "data", "monitoring"
    → bento-grid + dashboard-widgets + terminal
    → Stat cards, sparklines, live data feeds
分析用户请求时,将关键词与模板匹配:
用户请求分析:
├── 包含 "AI", "neural", "intelligent", "learning", "model", "GPT"
│   → cppn-hero + cppn-generative着色器
│   → 有机、流动的背景,营造“鲜活”感
├── 包含 "crypto", "blockchain", "trading", "global", "DeFi", "web3"
│   → globe-hero + data-grid着色器
│   → 地球图像、全球覆盖、金融精确
├── 包含 "developer", "API", "code", "build", "deploy", "ship"
│   → wave-hero + digital-liquid着色器
│   → 动态柱状图、打字动画、终端美学
├── 包含 "SaaS", "product", "waitlist", "brand", "startup", "launch"
│   → mesh-gradient-hero(无需WebGL)
│   → 柔和、流动的渐变,专业感
├── 包含 "futuristic", "cyber", "agency", "creative", "portfolio"
│   → hero-section(赛博朋克Hero) + holographic着色器
│   → 粒子球体、文本scramble、扫描线
└── 包含 "dashboard", "analytics", "metrics", "data", "monitoring"
    → bento-grid + dashboard-widgets + terminal
    → 统计卡片、迷你折线图、实时数据流

Performance-Based Selection

性能选择

Choose based on target audience and device constraints:
Performance TierTemplatesBest For
High-end (WebGL)
cppn-hero
,
wave-hero
,
hero-section
Desktop-first, portfolio sites, creative agencies
Medium (Canvas/Images)
globe-hero
Marketing sites, crypto landing pages
Light (CSS only)
mesh-gradient-hero
,
bento-grid
Mobile-first, SaaS, B2B, accessibility-focused
根据目标受众和设备约束选择:
性能层级模板最佳适用场景
高端(WebGL)
cppn-hero
,
wave-hero
,
hero-section
桌面优先、作品集网站、创意机构
中端(Canvas/图片)
globe-hero
营销网站、加密货币着陆页
轻量(仅CSS)
mesh-gradient-hero
,
bento-grid
移动端优先、SaaS、B2B、无障碍聚焦

Shader Pairing Guide

着色器配对指南

ShaderAestheticPairs Well With
cppn-generative
Neural, organic, mathematicalAI products, generative art, research tools
data-grid
Matrix, technical, cyberpunkCrypto, fintech, developer tools
digital-liquid
Flowing, dynamic, fluidCreative tools, media platforms
holographic
Sci-fi, iridescent, futuristicGaming, AR/VR, experimental projects
着色器美学风格适配场景
cppn-generative
神经网络、有机、数学感AI产品、生成艺术、研究工具
data-grid
矩阵、技术感、赛博朋克加密货币、金融科技、开发者工具
digital-liquid
流动、动态、流体创意工具、媒体平台
holographic
科幻、彩虹色、未来感游戏、AR/VR、实验性项目

Quick Decision Flowchart

快速决策流程图

Is performance critical (mobile-first)?
├── YES → mesh-gradient-hero (CSS only)
└── NO → Continue...
    Is it AI/ML related?
    ├── YES → cppn-hero
    └── NO → Continue...
        Is it crypto/global/financial?
        ├── YES → globe-hero
        └── NO → Continue...
            Is it developer-focused?
            ├── YES → wave-hero
            └── NO → hero-section (CyberpunkHero)

性能是否关键(移动端优先)?
├── 是 → mesh-gradient-hero(仅CSS)
└── 否 → 继续...
    是否与AI/ML相关?
    ├── 是 → cppn-hero
    └── 否 → 继续...
        是否与加密货币/全球化/金融相关?
        ├── 是 → globe-hero
        └── 否 → 继续...
            是否面向开发者?
            ├── 是 → wave-hero
            └── 否 → hero-section(赛博朋克Hero)

File Structure

文件结构

premium-frontend-skill/
├── SKILL.md                           # This document
├── examples/
│   ├── 01-racing-dashboard.tsx        # Motorsport telemetry
│   ├── 02-cyberpunk-platform.tsx      # Developer platform
│   ├── 03-bioluminescent-landing.tsx  # AI agency landing
│   ├── 04-fintech-protocol.tsx        # DeFi interface
│   └── 05-neural-interface.tsx        # Sentient AI core
├── templates/
│   ├── preloader.tsx                  # Boot sequence loader
│   ├── glass-components.tsx           # Glassmorphic UI elements
│   ├── terminal.tsx                   # Live logs display
│   ├── bento-grid.tsx                 # Dashboard layout system
│   ├── dashboard-widgets.tsx          # Stat cards, charts, metrics
│   ├── hero-section.tsx               # CyberpunkHero + StarfieldScene
│   ├── cppn-hero.tsx                  # Neural network shader hero
│   ├── mesh-gradient-hero.tsx         # Fluid gradient hero (CSS-light)
│   ├── wave-hero.tsx                  # Animated wave bars hero
│   └── globe-hero.tsx                 # 3D globe with dashboard
└── shaders/
    ├── cppn-generative.glsl.ts        # Neural pattern generator
    ├── digital-liquid.glsl.ts         # Flowing noise effect
    ├── data-grid.glsl.ts              # Matrix/grid effect
    └── holographic.glsl.ts            # Hologram interference

premium-frontend-skill/
├── SKILL.md                           # 本文档
├── examples/
│   ├── 01-racing-dashboard.tsx        # 赛车运动遥测
│   ├── 02-cyberpunk-platform.tsx      # 开发者平台
│   ├── 03-bioluminescent-landing.tsx  # AI机构着陆页
│   ├── 04-fintech-protocol.tsx        # DeFi界面
│   └── 05-neural-interface.tsx        # 智能AI核心
├── templates/
│   ├── preloader.tsx                  # 启动序列加载器
│   ├── glass-components.tsx           # 玻璃态UI元素
│   ├── terminal.tsx                   # 实时日志展示
│   ├── bento-grid.tsx                 # 仪表盘布局系统
│   ├── dashboard-widgets.tsx          # 统计卡片、图表、指标
│   ├── hero-section.tsx               # 赛博朋克Hero + 星空场景
│   ├── cppn-hero.tsx                  # 神经网络着色器Hero
│   ├── mesh-gradient-hero.tsx         # 流体渐变Hero(轻量CSS)
│   ├── wave-hero.tsx                  # 动画波浪条Hero
│   └── globe-hero.tsx                 # 3D地球 + 仪表盘
└── shaders/
    ├── cppn-generative.glsl.ts        # 神经网络图案生成器
    ├── digital-liquid.glsl.ts         # 流动噪声效果
    ├── data-grid.glsl.ts              # 矩阵/网格效果
    └── holographic.glsl.ts            # 全息干涉效果

Remember

谨记

"The goal is to create interfaces that feel alive, cinematic, and unforgettable. Every pixel should be intentional. These aren't just websites—they're experiences."
Don't hold back. Show what can truly be created when thinking outside the box and committing fully to a distinctive vision.
“目标是打造鲜活电影质感令人难忘的界面。每一个像素都需精心设计。这些不只是网站——是体验。”
不要束缚自己,展示跳出常规、完全专注于独特愿景时所能创造的真正杰作。