Animation skill · Web
Scroll effects
Reveals, sticky stories and progress driven by scroll.
Give this skill to your AI agent
Run this in your project. Claude Code picks it up from .claude/skills; for other agents, paste the file into their rules.
mkdir -p .claude/skills/scroll-effects && curl -fsSL https://kitesmotion.com/skills/scroll-effects/SKILL.md -o .claude/skills/scroll-effects/SKILL.mdScroll effects should help people follow a story or keep context. They must never block scrolling or hide content.
Prefer CSS scroll-driven animations
They run off the main thread and need no JavaScript.
css@supports (animation-timeline: view()) {
.reveal {
animation: reveal linear both;
animation-timeline: view();
animation-range: entry 10% cover 30%;
}
}
@keyframes reveal {
from { opacity: 0; transform: translateY(16px); }
to { opacity: 1; transform: none; }
}view()tracks an element crossing the viewport;scroll()tracks a scroller's progress.- Use
animation-rangeto decide exactly when an effect starts and ends. - Use
lineareasing; the scroll position is the easing.
Common recipes
- Reading progress bar:
scaleXfrom 0 to 1 onanimation-timeline: scroll(root). - Shrinking header: scale the avatar and title down over the first 120-200px of scroll.
- Sticky story: a
position: stickystage inside a tall section; swap content with ranges. - Parallax: move background layers at 10-30% of scroll speed, never the text.
JavaScript fallback
Use IntersectionObserver for one-off reveals and GSAP ScrollTrigger or Framer Motion useScroll only when CSS cannot do it. Throttle work to requestAnimationFrame.
Rules
- Content must be readable with animations disabled; animate from a visible state when possible.
- Never hijack or smooth the native scroll by default.
- Avoid scroll-linked effects on long forms and data pages.
- Reduced motion: show the final state immediately.