modern-web-design by freshtechbro/claudedesignskills
npx skills add https://github.com/freshtechbro/claudedesignskills --skill modern-web-design2024-2025 年的现代网页设计强调性能、可访问性和有意义的交互。本技能提供了关于当前设计趋势、实现模式和最佳实践的全面指导,以创建引人入胜、易于访问且性能卓越的网页体验。
此元技能综合了本仓库中所有动画、交互和 3D 技能的知识,以提供全面的设计指导。
理念:设计决策应优先考虑所有设备上的核心网页指标和用户体验。
关键指标:
实施指南:
相关技能:gsap-scrolltrigger、motion-framer、lottie-animations 用于优化动画
特征:
广告位招租
在这里展示您的产品或服务
触达数万 AI 开发者,精准高效
版式比例(现代流体系统):
/* 使用 clamp() 的流体版式 */
--font-size-xs: clamp(0.75rem, 0.7rem + 0.25vw, 0.875rem);
--font-size-sm: clamp(0.875rem, 0.8rem + 0.375vw, 1rem);
--font-size-base: clamp(1rem, 0.9rem + 0.5vw, 1.25rem);
--font-size-lg: clamp(1.25rem, 1.1rem + 0.75vw, 1.75rem);
--font-size-xl: clamp(1.75rem, 1.5rem + 1.25vw, 2.5rem);
--font-size-2xl: clamp(2.5rem, 2rem + 2.5vw, 4rem);
--font-size-3xl: clamp(3.5rem, 2.5rem + 5vw, 6rem);
色彩系统(可访问性优先):
/* 符合 WCAG AAA 标准的色彩系统 */
--color-primary: oklch(50% 0.2 250); /* 蓝色 */
--color-accent: oklch(65% 0.25 30); /* 珊瑚色 */
--color-neutral-50: oklch(98% 0 0);
--color-neutral-900: oklch(20% 0 0);
/* 对比度:文本至少 7:1 */
相关技能:animated-component-libraries 用于 UI 组件
定义:提供反馈、引导用户并增强感知性能的小型、有目的的动画。
类别:
a) 悬停状态(桌面):
b) 加载状态:
c) 交互反馈:
实现示例 (Framer Motion):
// 带有微交互的按钮
<motion.button
whileHover={{ scale: 1.05, y: -2 }}
whileTap={{ scale: 0.95 }}
transition={{ type: "spring", stiffness: 400, damping: 17 }}
>
Click me
</motion.button>
相关技能:motion-framer、react-spring-physics、animejs 用于微交互
定义:叙事驱动的体验,内容随着用户滚动而显示和变换。
模式:
a) 滚动触发显示:
b) 滚动链接动画:
c) 进度指示器:
实现示例 (GSAP ScrollTrigger):
// 滚动链接的 3D 旋转
gsap.to(".cube", {
scrollTrigger: {
trigger: ".section",
start: "top top",
end: "bottom top",
scrub: 1, // 平滑擦洗
},
rotationY: 360,
ease: "none"
});
相关技能:gsap-scrolltrigger、locomotive-scroll、scroll-reveal-libraries、react-three-fiber 用于 3D 滚动叙事
演变:增强交互并提供上下文反馈的自定义光标。
模式:
a) 自定义光标形状:
b) 上下文变换:
c) 性能考虑:
prefers-reduced-motion实现示例:
// 简单的平滑光标跟随器
const cursor = document.querySelector('.cursor');
let mouseX = 0, mouseY = 0;
let cursorX = 0, cursorY = 0;
document.addEventListener('mousemove', (e) => {
mouseX = e.clientX;
mouseY = e.clientY;
});
function updateCursor() {
// 平滑缓动
cursorX += (mouseX - cursorX) * 0.1;
cursorY += (mouseY - cursorY) * 0.1;
cursor.style.transform = `translate(${cursorX}px, ${cursorY}px)`;
requestAnimationFrame(updateCursor);
}
updateCursor();
相关技能:gsap-scrolltrigger(用于缓动)、motion-framer(用于 React 光标组件)
特征:
现代玻璃态拟物化 (2024):
.glass-card {
background: rgba(255, 255, 255, 0.1);
backdrop-filter: blur(10px) saturate(180%);
border: 1px solid rgba(255, 255, 255, 0.2);
box-shadow: 0 8px 32px rgba(0, 0, 0, 0.1);
border-radius: 16px;
}
深度系统(分层):
/* 高程比例 */
--elevation-1: 0 1px 3px rgba(0,0,0,0.12);
--elevation-2: 0 4px 8px rgba(0,0,0,0.15);
--elevation-3: 0 8px 16px rgba(0,0,0,0.18);
--elevation-4: 0 16px 32px rgba(0,0,0,0.2);
相关技能:animated-component-libraries 用于玻璃态拟物化组件
模式:
a) 自适应内容:
b) 智能交互:
c) 性能 + 隐私:
实施注意事项:
用例:着陆页、产品发布、作品集网站
特征:
实现(组合方法):
HTML 结构:
<section class="hero">
<div id="bg-canvas"></div>
<div class="hero__content">
<h1 class="hero__title">现代设计</h1>
<p class="hero__subtitle">性能与美学的结合</p>
<button class="hero__cta">探索</button>
</div>
<div class="scroll-indicator">
<span>滚动</span>
</div>
</section>
技术:
lightweight-3d-effects)gsap-scrolltrigger)motion-framer)相关技能:lightweight-3d-effects、gsap-scrolltrigger、motion-framer
用例:作品集展示、产品展示、案例研究
实现 (GSAP ScrollTrigger):
gsap.to(".gallery__track", {
x: () => -(document.querySelector(".gallery__track").scrollWidth - window.innerWidth),
ease: "none",
scrollTrigger: {
trigger: ".gallery",
pin: true,
scrub: 1,
end: () => "+=" + document.querySelector(".gallery__track").scrollWidth
}
});
增强功能:
相关技能:gsap-scrolltrigger、locomotive-scroll
用例:电子商务、产品营销、展示
实现 (React Three Fiber):
import { Canvas } from '@react-three/fiber'
import { OrbitControls, useGLTF } from '@react-three/drei'
function ProductViewer() {
return (
<Canvas camera={{ position: [0, 0, 5], fov: 50 }}>
<ambientLight intensity={0.5} />
<spotLight position={[10, 10, 10]} angle={0.15} />
<Product />
<OrbitControls
enableZoom={false}
autoRotate
autoRotateSpeed={2}
/>
</Canvas>
)
}
增强功能:
相关技能:react-three-fiber、threejs-webgl、model-viewer-component
用例:仪表板、分析、信息图表
模式:
实现 (Framer Motion + IntersectionObserver):
function AnimatedStat({ end, label }) {
const [count, setCount] = useState(0);
const ref = useRef();
const isInView = useInView(ref, { once: true });
useEffect(() => {
if (isInView) {
// 数字递增动画
const duration = 2000;
const steps = 60;
const increment = end / steps;
let current = 0;
const timer = setInterval(() => {
current += increment;
if (current >= end) {
setCount(end);
clearInterval(timer);
} else {
setCount(Math.floor(current));
}
}, duration / steps);
}
}, [isInView, end]);
return (
<motion.div
ref={ref}
initial={{ opacity: 0, y: 20 }}
animate={isInView ? { opacity: 1, y: 0 } : {}}
transition={{ duration: 0.6 }}
>
<h2>{count}+</h2>
<p>{label}</p>
</motion.div>
);
}
相关技能:motion-framer、pixijs-2d 用于基于画布的 2D 可视化
用例:多页面应用、作品集网站、叙事体验
实现 (Barba.js + GSAP):
barba.init({
transitions: [{
name: 'slide',
leave(data) {
return gsap.to(data.current.container, {
xPercent: -100,
duration: 0.5
});
},
enter(data) {
return gsap.from(data.next.container, {
xPercent: 100,
duration: 0.5
});
}
}]
});
现代替代方案:
相关技能:barba-js、gsap-scrolltrigger、motion-framer
用例:创意机构、作品集、交互式体验
模式:
实现 (Vanilla JS + GSAP):
const links = document.querySelectorAll('a');
const cursor = document.querySelector('.cursor');
links.forEach(link => {
link.addEventListener('mouseenter', () => {
gsap.to(cursor, {
scale: 2,
duration: 0.3,
ease: "power2.out"
});
});
link.addEventListener('mouseleave', () => {
gsap.to(cursor, {
scale: 1,
duration: 0.3,
ease: "power2.out"
});
});
});
相关技能:gsap-scrolltrigger、motion-framer
用例:功能部分、推荐语、团队网格
实现 (Framer Motion 变体):
const container = {
hidden: { opacity: 0 },
show: {
opacity: 1,
transition: {
staggerChildren: 0.1
}
}
};
const item = {
hidden: { opacity: 0, y: 20 },
show: { opacity: 1, y: 0 }
};
function FeatureGrid() {
return (
<motion.div
variants={container}
initial="hidden"
whileInView="show"
viewport={{ once: true, amount: 0.3 }}
className="grid"
>
{features.map((feature, i) => (
<motion.div key={i} variants={item}>
{feature}
</motion.div>
))}
</motion.div>
);
}
相关技能:motion-framer、gsap-scrolltrigger、scroll-reveal-libraries
GSAP ScrollTrigger (gsap-scrolltrigger):
Framer Motion (motion-framer):
React Spring (react-spring-physics):
Anime.js (animejs):
Lottie (lottie-animations):
Three.js (threejs-webgl):
React Three Fiber (react-three-fiber):
Babylon.js (babylonjs-engine):
轻量级 3D (lightweight-3d-effects):
动画组件 (animated-component-libraries):
滚动显示 (scroll-reveal-libraries):
尊重用户偏好:
@media (prefers-reduced-motion: reduce) {
*,
*::before,
*::after {
animation-duration: 0.01ms !important;
animation-iteration-count: 1 !important;
transition-duration: 0.01ms !important;
scroll-behavior: auto !important;
}
}
JavaScript 检测:
const prefersReducedMotion = window.matchMedia('(prefers-reduced-motion: reduce)').matches;
if (prefersReducedMotion) {
// 禁用或简化动画
gsap.config({ nullTargetWarn: false });
// 跳过滚动动画,使用即时显示
}
WCAG AAA 标准:
测试:
// 检查对比度
function getContrastRatio(color1, color2) {
const l1 = getLuminance(color1);
const l2 = getLuminance(color2);
const lighter = Math.max(l1, l2);
const darker = Math.min(l1, l2);
return (lighter + 0.05) / (darker + 0.05);
}
要求:
焦点样式(现代):
:focus-visible {
outline: 3px solid var(--color-accent);
outline-offset: 2px;
border-radius: 4px;
}
/* 为鼠标用户移除焦点环 */
:focus:not(:focus-visible) {
outline: none;
}
语义化 HTML:
动画播报:
<!-- 内容加载完成时播报 -->
<div role="status" aria-live="polite" aria-atomic="true">
加载完成。显示了 12 个项目。
</div>
最小尺寸:44x44px (iOS), 48x48px (Android)
间距:触摸目标之间至少 8px
实现:
.button {
min-height: 44px;
min-width: 44px;
padding: 12px 24px;
/* 触摸目标包括内边距 */
}
60 FPS 检查清单:
will-change(内存成本)GSAP 性能:
// 强制 GPU 加速
gsap.set(element, { force3D: true });
// 仅在动画期间使用 will-change
gsap.to(element, {
x: 100,
onStart: () => element.style.willChange = 'transform',
onComplete: () => element.style.willChange = 'auto'
});
关键路径:
渐进增强:
<!-- 首先加载基本样式 -->
<style>
/* 内联的关键 CSS */
</style>
<!-- 延迟非关键样式 -->
<link rel="preload" href="animations.css" as="style" onload="this.onload=null;this.rel='stylesheet'">
<noscript><link rel="stylesheet" href="animations.css"></noscript>
现代格式:
<picture>
<source srcset="image.avif" type="image/avif">
<source srcset="image.webp" type="image/webp">
<img src="image.jpg" alt="描述" loading="lazy">
</picture>
响应式图像:
<img
srcset="image-400.jpg 400w,
image-800.jpg 800w,
image-1200.jpg 1200w"
sizes="(max-width: 640px) 100vw,
(max-width: 1024px) 50vw,
33vw"
src="image-800.jpg"
alt="描述"
loading="lazy"
>
加载策略:
运行时性能:
相关技能:threejs-webgl、react-three-fiber、babylonjs-engine
代码分割:
// 动态导入
const AnimationModule = lazy(() => import('./animations'));
// 基于路由的分割
const Gallery = lazy(() => import('./pages/Gallery'));
摇树优化:
问题:过多的动画会分散对内容的注意力并损害性能。
解决方案:
经验法则:如果你无法解释某个动画存在的理由,就删除它。
问题:动画在桌面上有效,但在移动设备上卡顿。
解决方案:
matchMedia 实现设备特定体验const isLowEndDevice = () => {
return /Android|webOS|iPhone|iPad|iPod|BlackBerry/i.test(navigator.userAgent) &&
navigator.hardwareConcurrency < 4;
};
if (isLowEndDevice()) {
// 简化或禁用动画
}
问题:在没有 JavaScript 或旧版浏览器上体验中断。
解决方案:
// 特性检测
if ('IntersectionObserver' in window) {
// 使用滚动触发动画
} else {
// 立即显示内容
}
问题:忘记键盘用户、屏幕阅读器或对动效敏感的用户。
解决方案:
prefers-reduced-motion检查清单:
问题:内容加载期间出现空白屏幕或布局偏移。
解决方案:
// 骨架屏模式
function ProductCard({ loading, data }) {
if (loading) {
return (
<div className="skeleton">
<div className="skeleton__image" />
<div className="skeleton__title" />
<div className="skeleton__price" />
</div>
);
}
return <ProductCardContent data={data} />;
}
问题:覆盖原生滚动行为会使用户感到沮丧。
解决方案:
良好实践:增强滚动,而不是替换它。
现代设计令牌 (CSS 自定义属性):
:root {
/* 颜色 - OKLCH 用于感知均匀性 */
--color-primary: oklch(50% 0.2 250);
--color-accent: oklch(65% 0.25 30);
/* 间距 - 一致的比例 */
--space-2xs: clamp(0.25rem, 0.2rem + 0.25vw, 0.375rem);
--space-xs: clamp(0.5rem, 0.4rem + 0.5vw, 0.75rem);
--space-sm: clamp(0.75rem, 0.6rem + 0.75vw, 1.125rem);
--space-md: clamp(1rem, 0.8rem + 1vw, 1.5rem);
--space-lg: clamp(1.5rem, 1.2rem + 1.5vw, 2.25rem);
--space-xl: clamp(2rem, 1.6rem + 2vw, 3rem);
--space-2xl: clamp(3rem, 2.4rem + 3vw, 4.5rem);
/* 版式 - 流体比例 */
--font-size-base: clamp(1rem, 0.9rem + 0.5vw, 1.25rem);
/* 动画 - 一致的时序 */
--duration-fast: 150ms;
--duration-normal: 250ms;
--duration-slow: 400ms;
/* 缓动 - 自然动效 */
--ease-in-out: cubic-bezier(0.4, 0, 0.2, 1);
--ease-spring: cubic-bezier(0.34, 1.56, 0.64, 1);
}
原子设计 (Brad Frost):
相关技能:animated-component-libraries 用于组件模式
本技能参考以下技能进行实现:
gsap-scrolltrigger - 滚动驱动动画、固定、擦洗motion-framer - React 动画、手势、布局动画react-spring-physics - 基于物理的动画animejs - SVG 动画、错开效果lottie-animations - 设计师创建的动画scroll-reveal-libraries - 简单的滚动显示 (AOS)threejs-webgl - 自定义 3D 场景和效果react-three-fiber - React 应用中的 3Dbabylonjs-engine - 基于物理的 3D、VR/XRlightweight-3d-effects - Vanta.js 背景、Zdog 插图barba-js - 页面过渡locomotive-scroll - 平滑滚动animated-component-libraries - Magic UI、React Bitspixijs-2d - 基于画布的 2D 图形请参阅 references/ 目录以获取深入文档:
design_trends_2024.md - 当前网页设计趋势和预测interaction_patterns.md - 全面的微交互目录accessibility_guide.md - WCAG 合规模式和测试performance_checklist.md - 优化策略和指标scripts/ 目录包含用于实现设计模式的工具:
pattern_generator.py - 生成设计模式样板design_audit.py - 审计现有设计是否符合规范assets/ 目录包含设计系统模板和起始文件。详情请参阅 assets/README.md。
每周安装
88
仓库
GitHub 星标
11
首次出现
2026年2月27日
安全审计
安装于
opencode86
cursor84
kimi-cli84
gemini-cli84
amp84
cline84
Modern web design in 2024-2025 emphasizes performance, accessibility, and meaningful interactions. This skill provides comprehensive guidance on current design trends, implementation patterns, and best practices for creating engaging, accessible, and performant web experiences.
This meta-skill synthesizes knowledge from all animation, interaction, and 3D skills in this repository to provide holistic design guidance.
Philosophy : Design decisions should prioritize Core Web Vitals and user experience on all devices.
Key Metrics :
Implementation Guidelines :
Related Skills : gsap-scrolltrigger, motion-framer, lottie-animations for optimized animations
Characteristics :
Typography Scale (Modern fluid system):
/* Fluid typography using clamp() */
--font-size-xs: clamp(0.75rem, 0.7rem + 0.25vw, 0.875rem);
--font-size-sm: clamp(0.875rem, 0.8rem + 0.375vw, 1rem);
--font-size-base: clamp(1rem, 0.9rem + 0.5vw, 1.25rem);
--font-size-lg: clamp(1.25rem, 1.1rem + 0.75vw, 1.75rem);
--font-size-xl: clamp(1.75rem, 1.5rem + 1.25vw, 2.5rem);
--font-size-2xl: clamp(2.5rem, 2rem + 2.5vw, 4rem);
--font-size-3xl: clamp(3.5rem, 2.5rem + 5vw, 6rem);
Color System (Accessibility-first):
/* WCAG AAA compliant color system */
--color-primary: oklch(50% 0.2 250); /* Blue */
--color-accent: oklch(65% 0.25 30); /* Coral */
--color-neutral-50: oklch(98% 0 0);
--color-neutral-900: oklch(20% 0 0);
/* Contrast ratio: minimum 7:1 for text */
Related Skills : animated-component-libraries for UI components
Definition : Small, purposeful animations that provide feedback, guide users, and enhance perceived performance.
Categories :
a) Hover States (Desktop):
b) Loading States :
c) Interactive Feedback :
Implementation Example (Framer Motion):
// Button with micro-interaction
<motion.button
whileHover={{ scale: 1.05, y: -2 }}
whileTap={{ scale: 0.95 }}
transition={{ type: "spring", stiffness: 400, damping: 17 }}
>
Click me
</motion.button>
Related Skills : motion-framer, react-spring-physics, animejs for micro-interactions
Definition : Narrative-driven experiences where content reveals and transforms as the user scrolls.
Patterns :
a) Scroll-Triggered Reveals :
b) Scroll-Linked Animations :
c) Progress Indicators :
Implementation Example (GSAP ScrollTrigger):
// Scroll-linked 3D rotation
gsap.to(".cube", {
scrollTrigger: {
trigger: ".section",
start: "top top",
end: "bottom top",
scrub: 1, // Smooth scrubbing
},
rotationY: 360,
ease: "none"
});
Related Skills : gsap-scrolltrigger, locomotive-scroll, scroll-reveal-libraries, react-three-fiber for 3D scrollytelling
Evolution : Custom cursors that enhance interaction and provide contextual feedback.
Patterns :
a) Custom Cursor Shapes :
b) Contextual Transformations :
c) Performance Considerations :
prefers-reduced-motionImplementation Example :
// Simple smooth cursor follower
const cursor = document.querySelector('.cursor');
let mouseX = 0, mouseY = 0;
let cursorX = 0, cursorY = 0;
document.addEventListener('mousemove', (e) => {
mouseX = e.clientX;
mouseY = e.clientY;
});
function updateCursor() {
// Smooth easing
cursorX += (mouseX - cursorX) * 0.1;
cursorY += (mouseY - cursorY) * 0.1;
cursor.style.transform = `translate(${cursorX}px, ${cursorY}px)`;
requestAnimationFrame(updateCursor);
}
updateCursor();
Related Skills : gsap-scrolltrigger (for easing), motion-framer (for React cursor components)
Characteristics :
Modern Glassmorphism (2024):
.glass-card {
background: rgba(255, 255, 255, 0.1);
backdrop-filter: blur(10px) saturate(180%);
border: 1px solid rgba(255, 255, 255, 0.2);
box-shadow: 0 8px 32px rgba(0, 0, 0, 0.1);
border-radius: 16px;
}
Depth System (Layering):
/* Elevation scale */
--elevation-1: 0 1px 3px rgba(0,0,0,0.12);
--elevation-2: 0 4px 8px rgba(0,0,0,0.15);
--elevation-3: 0 8px 16px rgba(0,0,0,0.18);
--elevation-4: 0 16px 32px rgba(0,0,0,0.2);
Related Skills : animated-component-libraries for glassmorphic components
Patterns :
a) Adaptive Content :
b) Intelligent Interactions :
c) Performance + Privacy :
Implementation Considerations :
Use Case : Landing pages, product launches, portfolio sites
Characteristics :
Implementation (Combined approach):
HTML Structure :
<section class="hero">
<div id="bg-canvas"></div>
<div class="hero__content">
<h1 class="hero__title">Modern Design</h1>
<p class="hero__subtitle">Performance meets beauty</p>
<button class="hero__cta">Explore</button>
</div>
<div class="scroll-indicator">
<span>Scroll</span>
</div>
</section>
Technologies :
lightweight-3d-effects)gsap-scrolltrigger)motion-framer)Related Skills : lightweight-3d-effects, gsap-scrolltrigger, motion-framer
Use Case : Portfolio work, product showcases, case studies
Implementation (GSAP ScrollTrigger):
gsap.to(".gallery__track", {
x: () => -(document.querySelector(".gallery__track").scrollWidth - window.innerWidth),
ease: "none",
scrollTrigger: {
trigger: ".gallery",
pin: true,
scrub: 1,
end: () => "+=" + document.querySelector(".gallery__track").scrollWidth
}
});
Enhancements :
Related Skills : gsap-scrolltrigger, locomotive-scroll
Use Case : E-commerce, product marketing, showcases
Implementation (React Three Fiber):
import { Canvas } from '@react-three/fiber'
import { OrbitControls, useGLTF } from '@react-three/drei'
function ProductViewer() {
return (
<Canvas camera={{ position: [0, 0, 5], fov: 50 }}>
<ambientLight intensity={0.5} />
<spotLight position={[10, 10, 10]} angle={0.15} />
<Product />
<OrbitControls
enableZoom={false}
autoRotate
autoRotateSpeed={2}
/>
</Canvas>
)
}
Enhancements :
Related Skills : react-three-fiber, threejs-webgl, model-viewer-component
Use Case : Dashboards, analytics, infographics
Patterns :
Implementation (Framer Motion + IntersectionObserver):
function AnimatedStat({ end, label }) {
const [count, setCount] = useState(0);
const ref = useRef();
const isInView = useInView(ref, { once: true });
useEffect(() => {
if (isInView) {
// Count up animation
const duration = 2000;
const steps = 60;
const increment = end / steps;
let current = 0;
const timer = setInterval(() => {
current += increment;
if (current >= end) {
setCount(end);
clearInterval(timer);
} else {
setCount(Math.floor(current));
}
}, duration / steps);
}
}, [isInView, end]);
return (
<motion.div
ref={ref}
initial={{ opacity: 0, y: 20 }}
animate={isInView ? { opacity: 1, y: 0 } : {}}
transition={{ duration: 0.6 }}
>
<h2>{count}+</h2>
<p>{label}</p>
</motion.div>
);
}
Related Skills : motion-framer, pixijs-2d for canvas-based visualizations
Use Case : Multi-page apps, portfolio sites, storytelling experiences
Implementation (Barba.js + GSAP):
barba.init({
transitions: [{
name: 'slide',
leave(data) {
return gsap.to(data.current.container, {
xPercent: -100,
duration: 0.5
});
},
enter(data) {
return gsap.from(data.next.container, {
xPercent: 100,
duration: 0.5
});
}
}]
});
Modern Alternatives :
Related Skills : barba-js, gsap-scrolltrigger, motion-framer
Use Case : Creative agencies, portfolios, interactive experiences
Patterns :
Implementation (Vanilla JS + GSAP):
const links = document.querySelectorAll('a');
const cursor = document.querySelector('.cursor');
links.forEach(link => {
link.addEventListener('mouseenter', () => {
gsap.to(cursor, {
scale: 2,
duration: 0.3,
ease: "power2.out"
});
});
link.addEventListener('mouseleave', () => {
gsap.to(cursor, {
scale: 1,
duration: 0.3,
ease: "power2.out"
});
});
});
Related Skills : gsap-scrolltrigger, motion-framer
Use Case : Feature sections, testimonials, team grids
Implementation (Framer Motion variants):
const container = {
hidden: { opacity: 0 },
show: {
opacity: 1,
transition: {
staggerChildren: 0.1
}
}
};
const item = {
hidden: { opacity: 0, y: 20 },
show: { opacity: 1, y: 0 }
};
function FeatureGrid() {
return (
<motion.div
variants={container}
initial="hidden"
whileInView="show"
viewport={{ once: true, amount: 0.3 }}
className="grid"
>
{features.map((feature, i) => (
<motion.div key={i} variants={item}>
{feature}
</motion.div>
))}
</motion.div>
);
}
Related Skills : motion-framer, gsap-scrolltrigger, scroll-reveal-libraries
GSAP ScrollTrigger (gsap-scrolltrigger):
Framer Motion (motion-framer):
React Spring (react-spring-physics):
Anime.js (animejs):
Lottie (lottie-animations):
Three.js (threejs-webgl):
React Three Fiber (react-three-fiber):
Babylon.js (babylonjs-engine):
Lightweight 3D (lightweight-3d-effects):
Animated Components (animated-component-libraries):
Scroll Reveals (scroll-reveal-libraries):
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;
scroll-behavior: auto !important;
}
}
JavaScript Detection :
const prefersReducedMotion = window.matchMedia('(prefers-reduced-motion: reduce)').matches;
if (prefersReducedMotion) {
// Disable or simplify animations
gsap.config({ nullTargetWarn: false });
// Skip scroll animations, use instant reveals
}
WCAG AAA Standards :
Testing :
// Check contrast ratio
function getContrastRatio(color1, color2) {
const l1 = getLuminance(color1);
const l2 = getLuminance(color2);
const lighter = Math.max(l1, l2);
const darker = Math.min(l1, l2);
return (lighter + 0.05) / (darker + 0.05);
}
Requirements :
Focus Styles (Modern):
:focus-visible {
outline: 3px solid var(--color-accent);
outline-offset: 2px;
border-radius: 4px;
}
/* Remove focus ring for mouse users */
:focus:not(:focus-visible) {
outline: none;
}
Semantic HTML :
Animation Announcements :
<!-- Announce when content loads -->
<div role="status" aria-live="polite" aria-atomic="true">
Loading complete. 12 items displayed.
</div>
Minimum Size : 44x44px (iOS), 48x48px (Android)
Spacing : Minimum 8px between touch targets
Implementation :
.button {
min-height: 44px;
min-width: 44px;
padding: 12px 24px;
/* Tap target includes padding */
}
60 FPS Checklist :
will-change sparingly (memory cost)GSAP Performance :
// Force GPU acceleration
gsap.set(element, { force3D: true });
// Use will-change during animation only
gsap.to(element, {
x: 100,
onStart: () => element.style.willChange = 'transform',
onComplete: () => element.style.willChange = 'auto'
});
Critical Path :
Progressive Enhancement :
<!-- Load essential styles first -->
<style>
/* Critical CSS inlined */
</style>
<!-- Defer non-critical styles -->
<link rel="preload" href="animations.css" as="style" onload="this.onload=null;this.rel='stylesheet'">
<noscript><link rel="stylesheet" href="animations.css"></noscript>
Modern Formats :
<picture>
<source srcset="image.avif" type="image/avif">
<source srcset="image.webp" type="image/webp">
<img src="image.jpg" alt="Description" loading="lazy">
</picture>
Responsive Images :
<img
srcset="image-400.jpg 400w,
image-800.jpg 800w,
image-1200.jpg 1200w"
sizes="(max-width: 640px) 100vw,
(max-width: 1024px) 50vw,
33vw"
src="image-800.jpg"
alt="Description"
loading="lazy"
>
Loading Strategy :
Runtime Performance :
Related Skills : threejs-webgl, react-three-fiber, babylonjs-engine
Code Splitting :
// Dynamic imports
const AnimationModule = lazy(() => import('./animations'));
// Route-based splitting
const Gallery = lazy(() => import('./pages/Gallery'));
Tree Shaking :
Problem : Too many animations distract from content and hurt performance.
Solution :
Rule of Thumb : If you can't explain why an animation exists, remove it.
Problem : Animations work on desktop but lag on mobile devices.
Solution :
Test on real devices (not just simulators)
Reduce animation complexity on mobile
Disable expensive effects (parallax, 3D) on low-end devices
Use matchMedia for device-specific experiences
const isLowEndDevice = () => { return /Android|webOS|iPhone|iPad|iPod|BlackBerry/i.test(navigator.userAgent) && navigator.hardwareConcurrency < 4; };
if (isLowEndDevice()) { // Simplify or disable animations }
Problem : Experience breaks without JavaScript or on older browsers.
Solution :
Progressive enhancement mindset
Core content accessible without JS
Feature detection before using modern APIs
Polyfills for critical features
// Feature detection if ('IntersectionObserver' in window) { // Use scroll-triggered animations } else { // Show content immediately }
Problem : Forgetting keyboard users, screen readers, or motion-sensitive users.
Solution :
prefers-reduced-motionChecklist :
Problem : Blank screen or layout shifts during content load.
Solution :
Skeleton screens for predictable layouts
Smooth loading transitions
Reserve space for dynamic content
Show meaningful loading indicators
// Skeleton screen pattern function ProductCard({ loading, data }) { if (loading) { return ( <div className="skeleton"> <div className="skeleton__image" /> <div className="skeleton__title" /> <div className="skeleton__price" /> </div> ); }
return <ProductCardContent data={data} />; }
Problem : Overriding native scroll behavior frustrates users.
Solution :
Good Practice : Enhance scroll, don't replace it.
Modern Design Tokens (CSS Custom Properties):
:root {
/* Colors - OKLCH for perceptual uniformity */
--color-primary: oklch(50% 0.2 250);
--color-accent: oklch(65% 0.25 30);
/* Spacing - Consistent scale */
--space-2xs: clamp(0.25rem, 0.2rem + 0.25vw, 0.375rem);
--space-xs: clamp(0.5rem, 0.4rem + 0.5vw, 0.75rem);
--space-sm: clamp(0.75rem, 0.6rem + 0.75vw, 1.125rem);
--space-md: clamp(1rem, 0.8rem + 1vw, 1.5rem);
--space-lg: clamp(1.5rem, 1.2rem + 1.5vw, 2.25rem);
--space-xl: clamp(2rem, 1.6rem + 2vw, 3rem);
--space-2xl: clamp(3rem, 2.4rem + 3vw, 4.5rem);
/* Typography - Fluid scale */
--font-size-base: clamp(1rem, 0.9rem + 0.5vw, 1.25rem);
/* Animation - Consistent timing */
--duration-fast: 150ms;
--duration-normal: 250ms;
--duration-slow: 400ms;
/* Easing - Natural motion */
--ease-in-out: cubic-bezier(0.4, 0, 0.2, 1);
--ease-spring: cubic-bezier(0.34, 1.56, 0.64, 1);
}
Atomic Design (Brad Frost):
Related Skills : animated-component-libraries for component patterns
This skill references the following skills for implementation:
gsap-scrolltrigger - Scroll-driven animations, pinning, scrubbingmotion-framer - React animations, gestures, layout animationsreact-spring-physics - Physics-based animationsanimejs - SVG animations, stagger effectslottie-animations - Designer-created animationsscroll-reveal-libraries - Simple scroll reveals (AOS)threejs-webgl - Custom 3D scenes and effectsreact-three-fiber - 3D in React applicationsbabylonjs-engine - Physics-based 3D, VR/XRlightweight-3d-effects - Vanta.js backgrounds, Zdog illustrationsbarba-js - Page transitionslocomotive-scroll - Smooth scrollinganimated-component-libraries - Magic UI, React Bitspixijs-2d - Canvas-based 2D graphicsSee the references/ directory for in-depth documentation:
design_trends_2024.md - Current web design trends and forecastsinteraction_patterns.md - Comprehensive micro-interaction catalogaccessibility_guide.md - WCAG compliance patterns and testingperformance_checklist.md - Optimization strategies and metricsThe scripts/ directory includes tools for implementing design patterns:
pattern_generator.py - Generate design pattern boilerplatedesign_audit.py - Audit existing designs for complianceThe assets/ directory contains design system templates and starter files. See assets/README.md for details.
Weekly Installs
88
Repository
GitHub Stars
11
First Seen
Feb 27, 2026
Security Audits
Gen Agent Trust HubPassSocketWarnSnykPass
Installed on
opencode86
cursor84
kimi-cli84
gemini-cli84
amp84
cline84
前端设计技能指南:避免AI垃圾美学,打造独特生产级界面
46,600 周安装