motion-advanced
Advanced motion patterns for React / Next.js — drag & drop, gestures, text animations, SVG path drawing, custom hooks, imperative sequences (useAnimate), loaders, and the full API decision tree. Requires motion-foundations.
Security Assessment
About motion-advanced
The motion-advanced skill provides advanced motion patterns for React and Next.js using the Motion library (motion/react), covering drag and drop, gestures, text animations, SVG path drawing, custom hooks, imperative sequences with useAnimate, loaders, and a full API decision tree. It handles complex, interactive, and physics-based animation that goes beyond simpler pattern skills, and it requires motion-foundations to be set up first because all token values are imported from that skill rather than written as inline numbers.
The skill produces concrete outputs: drag interactions (draggable cards, drag-to-dismiss sheets, Reorder.Group lists), gesture hooks (swipe detection, long press, pinch outline), text animation components (word reveal, character typewriter, number counter), SVG animation (path draw-on with pathLength, icon morph, stroke progress ring), custom hooks (useScrollReveal, useHoverScale, useNavigationDirection, useInViewOnce), imperative useAnimate sequences with interrupt-safe async/await, and loaders (spinner, shimmer, pulse dot, progress bar, button loading state). Its principles favor physics-based motion via useSpring for direct manipulation, useMotionValue plus useTransform for derived values without re-renders, and SSR-safe motion values that avoid hydration errors. Decision tables guide choosing the right API — for example drag plus dragTransition: springs.release for physics on release, Reorder.Group/Reorder.Item for ordered lists, drag="y" with an onDragEnd offset check for dismissal, and useAnimate for multi-step sequences.
The skill targets frontend developers building sophisticated interactive UI in React/Next.js. It enforces explicit rules: drag interactions must be tested on touch devices, infinite animations must pause when document.visibilityState is hidden, swipe thresholds must combine offset and velocity rather than velocity alone, the useAnimate scope ref must attach to a mounted DOM element, motion values must not be recreated on render, custom hooks must clean up their event listeners, and SVG morphing requires equal path command counts or paths snap instead of interpolating. Its primary stated requirement is a working motion-foundations setup supplying tokens such as springs.* and motionTokens.
FAQ
What prerequisite does motion-advanced need?
It requires motion-foundations to be set up first. All token values, including springs.* and motionTokens, are imported from motion-foundations — no inline numbers are used.
Which library and framework does it target?
It targets the Motion library (imported from motion/react) in React and Next.js applications, for complex, interactive, and physics-based animation patterns.
How do I choose between useSpring and a spring transition?
Use useSpring for continuously updated, pointer-tracked values like a cursor follower — it smoothly picks up from velocity on interrupt. Use transition: springs.* for discrete state changes triggered by state, which restart from the current value.
What are the key rules for drag and infinite animations?
Drag interactions must be tested on touch devices, not just mouse. Infinite animations must pause when document.visibilityState === "hidden" so background tabs do not consume GPU/CPU. Swipe thresholds must be explicit, combining offset and velocity checks rather than inferring from velocity alone.
Why might an SVG morph snap instead of interpolate?
SVG morphing requires equal path command counts. Paths with different command structures snap instead of interpolating, so the d attribute tween needs matching command counts on both paths.
Install motion-advanced
Quick Setup:
- Copy the skill folder to
.claude/skills/ - Claude will automatically detect and use the skill
Repository
affaan-m/everything-claude-code