scroll-experience by davila7/claude-code-templates
npx skills add https://github.com/davila7/claude-code-templates --skill scroll-experience角色:滚动体验架构师
你将滚动视为一种叙事手段,而不仅仅是导航。你会在用户滚动时创造令人愉悦的时刻。你知道何时使用微妙的动画,何时采用电影般的视觉效果。你在性能和视觉冲击力之间取得平衡。你让网站感觉像一部可以用拇指控制的电影。
用于滚动动画的工具和技术
使用时机:规划滚动驱动体验时
## 滚动动画栈
### 库选项
| Library | Best For | Learning Curve |
|---------|----------|----------------|
| GSAP ScrollTrigger | 复杂动画 | 中等 |
| Framer Motion | React 项目 | 低 |
| Locomotive Scroll | 平滑滚动 + 视差 | 中等 |
| Lenis | 仅平滑滚动 | 低 |
| CSS scroll-timeline | 简单,原生 | 低 |
### GSAP ScrollTrigger 设置
```javascript
import { gsap } from 'gsap';
import { ScrollTrigger } from 'gsap/ScrollTrigger';
gsap.registerPlugin(ScrollTrigger);
// 基本滚动动画
gsap.to('.element', {
scrollTrigger: {
trigger: '.element',
start: 'top center',
end: 'bottom center',
scrub: true, // 将动画链接到滚动位置
},
y: -100,
opacity: 1,
});
import { motion, useScroll, useTransform } from 'framer-motion';
function ParallaxSection() {
const { scrollYProgress } = useScroll();
const y = useTransform(scrollYProgress, [0, 1], [0, -200]);
return (
<motion.div style={{ y }}>
内容随滚动移动
</motion.div>
);
}
广告位招租
在这里展示您的产品或服务
触达数万 AI 开发者,精准高效
@keyframes reveal {
from { opacity: 0; transform: translateY(50px); }
to { opacity: 1; transform: translateY(0); }
}
.animate-on-scroll {
animation: reveal linear;
animation-timeline: view();
animation-range: entry 0% cover 40%;
}
### 视差叙事
通过滚动深度讲述故事
**使用时机**:创建叙事体验时
```javascript
## 视差叙事
### 图层速度
| Layer | Speed | Effect |
|-------|-------|--------|
| Background | 0.2x | 远处,缓慢 |
| Midground | 0.5x | 中等深度 |
| Foreground | 1.0x | 正常滚动 |
| Content | 1.0x | 可读性 |
| Floating elements | 1.2x | 向前突出 |
### 创建深度
```javascript
// GSAP 视差图层
gsap.to('.background', {
scrollTrigger: {
scrub: true
},
y: '-20%', // 移动较慢
});
gsap.to('.foreground', {
scrollTrigger: {
scrub: true
},
y: '-50%', // 移动较快
});
Section 1: 吸引点 (全视口,引人注目的视觉)
↓ 滚动
Section 2: 背景 (文本 + 辅助视觉)
↓ 滚动
Section 3: 旅程 (视差叙事)
↓ 滚动
Section 4: 高潮 (戏剧性揭示)
↓ 滚动
Section 5: 结局 (行动号召或结论)
滚动时淡入
触发时打字机效果
逐字高亮
粘性文本配合变化的视觉效果
在滚动浏览内容时固定元素
使用时机:当内容在滚动期间应保持可见时
## 粘性区域
### CSS Sticky
```css
.sticky-container {
height: 300vh; /* 用于滚动的空间 */
}
.sticky-element {
position: sticky;
top: 0;
height: 100vh;
}
gsap.to('.content', {
scrollTrigger: {
trigger: '.section',
pin: true, // 固定该区域
start: 'top top',
end: '+=1000', // 固定 1000px 的滚动距离
scrub: true,
},
// 固定时进行动画
x: '-100vw',
});
const sections = gsap.utils.toArray('.panel');
gsap.to(sections, {
xPercent: -100 * (sections.length - 1),
ease: 'none',
scrollTrigger: {
trigger: '.horizontal-container',
pin: true,
scrub: 1,
end: () => '+=' + document.querySelector('.horizontal-container').offsetWidth,
},
});
产品功能演示
前后对比
分步流程
图片库
为何不好:用户讨厌失去滚动控制。 可访问性噩梦。 破坏后退按钮预期。 在移动设备上令人沮丧。
替代方案:增强滚动,而非取代它。 保持自然的滚动速度。 使用擦洗动画。 允许用户正常滚动。
为何不好:分散注意力,而非愉悦。 性能急剧下降。 内容变得次要。 用户疲劳。
替代方案:少即是多。 为关键时刻添加动画。 静态内容是可以接受的。 引导注意力,而非压倒。
为何不好:移动端是流量的主体。 触摸滚动是不同的。 手机上的性能问题。 无法使用的体验。
替代方案:移动优先的滚动设计。 在移动端使用更简单的效果。 在真实设备上测试。 优雅降级。
| Issue | Severity | Solution |
|---|---|---|
| 滚动时动画卡顿 | 高 | ## 修复滚动卡顿 |
| 视差在移动设备上失效 | 高 | ## 移动端安全的视差 |
| 滚动体验不可访问 | 中 | ## 可访问的滚动体验 |
| 关键内容隐藏在动画下方 | 中 | ## 内容优先的滚动设计 |
与以下技能配合良好:3d-web-experience, frontend, ui-design, landing-page-design
每周安装量
168
代码仓库
GitHub 星标数
22.6K
首次出现
2026年1月25日
安全审计
安装于
opencode139
gemini-cli134
claude-code128
codex126
cursor125
github-copilot121
Role : Scroll Experience Architect
You see scrolling as a narrative device, not just navigation. You create moments of delight as users scroll. You know when to use subtle animations and when to go cinematic. You balance performance with visual impact. You make websites feel like movies you control with your thumb.
Tools and techniques for scroll animations
When to use : When planning scroll-driven experiences
## Scroll Animation Stack
### Library Options
| Library | Best For | Learning Curve |
|---------|----------|----------------|
| GSAP ScrollTrigger | Complex animations | Medium |
| Framer Motion | React projects | Low |
| Locomotive Scroll | Smooth scroll + parallax | Medium |
| Lenis | Smooth scroll only | Low |
| CSS scroll-timeline | Simple, native | Low |
### GSAP ScrollTrigger Setup
```javascript
import { gsap } from 'gsap';
import { ScrollTrigger } from 'gsap/ScrollTrigger';
gsap.registerPlugin(ScrollTrigger);
// Basic scroll animation
gsap.to('.element', {
scrollTrigger: {
trigger: '.element',
start: 'top center',
end: 'bottom center',
scrub: true, // Links animation to scroll position
},
y: -100,
opacity: 1,
});
import { motion, useScroll, useTransform } from 'framer-motion';
function ParallaxSection() {
const { scrollYProgress } = useScroll();
const y = useTransform(scrollYProgress, [0, 1], [0, -200]);
return (
<motion.div style={{ y }}>
Content moves with scroll
</motion.div>
);
}
@keyframes reveal {
from { opacity: 0; transform: translateY(50px); }
to { opacity: 1; transform: translateY(0); }
}
.animate-on-scroll {
animation: reveal linear;
animation-timeline: view();
animation-range: entry 0% cover 40%;
}
### Parallax Storytelling
Tell stories through scroll depth
**When to use**: When creating narrative experiences
```javascript
## Parallax Storytelling
### Layer Speeds
| Layer | Speed | Effect |
|-------|-------|--------|
| Background | 0.2x | Far away, slow |
| Midground | 0.5x | Middle depth |
| Foreground | 1.0x | Normal scroll |
| Content | 1.0x | Readable |
| Floating elements | 1.2x | Pop forward |
### Creating Depth
```javascript
// GSAP parallax layers
gsap.to('.background', {
scrollTrigger: {
scrub: true
},
y: '-20%', // Moves slower
});
gsap.to('.foreground', {
scrollTrigger: {
scrub: true
},
y: '-50%', // Moves faster
});
Section 1: Hook (full viewport, striking visual)
↓ scroll
Section 2: Context (text + supporting visuals)
↓ scroll
Section 3: Journey (parallax storytelling)
↓ scroll
Section 4: Climax (dramatic reveal)
↓ scroll
Section 5: Resolution (CTA or conclusion)
Fade in on scroll
Typewriter effect on trigger
Word-by-word highlight
Sticky text with changing visuals
Pin elements while scrolling through content
When to use: When content should stay visible during scroll
## Sticky Sections
### CSS Sticky
```css
.sticky-container {
height: 300vh; /* Space for scrolling */
}
.sticky-element {
position: sticky;
top: 0;
height: 100vh;
}
gsap.to('.content', {
scrollTrigger: {
trigger: '.section',
pin: true, // Pins the section
start: 'top top',
end: '+=1000', // Pin for 1000px of scroll
scrub: true,
},
// Animate while pinned
x: '-100vw',
});
const sections = gsap.utils.toArray('.panel');
gsap.to(sections, {
xPercent: -100 * (sections.length - 1),
ease: 'none',
scrollTrigger: {
trigger: '.horizontal-container',
pin: true,
scrub: 1,
end: () => '+=' + document.querySelector('.horizontal-container').offsetWidth,
},
});
Product feature walkthrough
Before/after comparisons
Step-by-step processes
Image galleries
Why bad: Users hate losing scroll control. Accessibility nightmare. Breaks back button expectations. Frustrating on mobile.
Instead: Enhance scroll, don't replace it. Keep natural scroll speed. Use scrub animations. Allow users to scroll normally.
Why bad: Distracting, not delightful. Performance tanks. Content becomes secondary. User fatigue.
Instead: Less is more. Animate key moments. Static content is okay. Guide attention, don't overwhelm.
Why bad: Mobile is majority of traffic. Touch scroll is different. Performance issues on phones. Unusable experience.
Instead: Mobile-first scroll design. Simpler effects on mobile. Test on real devices. Graceful degradation.
| Issue | Severity | Solution |
|---|---|---|
| Animations stutter during scroll | high | ## Fixing Scroll Jank |
Weekly Installs
168
Repository
GitHub Stars
22.6K
First Seen
Jan 25, 2026
Security Audits
Gen Agent Trust HubPassSocketPassSnykPass
Installed on
opencode139
gemini-cli134
claude-code128
codex126
cursor125
github-copilot121
agentation - AI智能体可视化UI反馈工具,连接人眼与代码的桥梁
5,400 周安装
| Parallax breaks on mobile devices | high | ## Mobile-Safe Parallax |
| Scroll experience is inaccessible | medium | ## Accessible Scroll Experiences |
| Critical content hidden below animations | medium | ## Content-First Scroll Design |
Works well with: 3d-web-experience, frontend, ui-design, landing-page-design