Animation skill · Web
Page transitions
Smooth moves between pages and views, with shared elements.
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/page-transitions && curl -fsSL https://kitesmotion.com/skills/page-transitions/SKILL.md -o .claude/skills/page-transitions/SKILL.mdTransitions should show how screens relate: what moved, what replaced what, and where the user is now.
Pick the right pattern
| Relationship | Transition |
|---|---|
| Drilling into an item (list to detail) | Shared element: the card grows into the page |
| Moving between sibling tabs | Slide 8-24px in the direction of the tab plus fade |
| Opening a temporary layer | Sheet or dialog over the page; the page stays put |
| Unrelated pages | Quick cross-fade, 180-250ms |
View Transitions API (web)
jsif (!document.startViewTransition) update();
else document.startViewTransition(() => update());css.card-image { view-transition-name: hero; }
::view-transition-old(root), ::view-transition-new(root) {
animation-duration: 280ms;
animation-timing-function: cubic-bezier(0.16, 1, 0.3, 1);
}- Give each shared element a unique
view-transition-name(only one element per name on the page). - In Next.js App Router, start the transition before
router.push, or use a transition-aware link helper.
Layout animations (React)
Use Framer Motion layoutId for shared elements and AnimatePresence for enter and exit:
tsx<motion.img layoutId={`photo-${id}`} />Rules
- Keep the old page visible until the new one is ready; never flash an empty screen.
- Animate the content, not the whole viewport, when only part of the page changes.
- Back navigation reverses the forward animation.
- Restore scroll position on back.
- Reduced motion: replace movement with a short cross-fade.