12-principles-of-anima…
Audit animation code against Disney's 12 principles adapted for web. Use when reviewing motion, implementing animations, or…
Audit animation code for correct timing function selection. Use when reviewing motion implementations, debugging animations that feel wrong, or choosing between springs and easing. Outputs file:line findings.
$ npx -y skills add raphaelsalaja/skill --skill to-spring-or-not-to-spring --agent claude-codeHow it fires
How this skill gets triggered: by you, by Claude, or both.
/to-spring-or-not-to-springContext preview
The summary Claude sees to decide when to auto-load this skill.
Audit animation code for correct timing function selection. Use when reviewing motion implementations, debugging animations that feel wrong, or choosing between springs and easing. Outputs file:line findings.
name: to-spring-or-not-to-spring description: Audit animation code for correct timing function selection. Use when reviewing motion implementations, debugging animations that feel wrong, or choosing between springs and easing. Outputs file:line findings. license: MIT metadata: author: raphael-salaja version: "2.0.0" source: /content/to-spring-or-not-to-spring/index.mdx
Review animation code for correct timing function selection based on interaction type.
1. Read the specified files (or prompt user for files/pattern) 2. Check against all rules below 3. Output findings in `file:line` format
| Priority | Category | Prefix | |----------|----------|--------| | 1 | Spring Selection | `spring-` | | 2 | Easing Selection | `easing-` | | 3 | Duration | `duration-` | | 4 | No Animation | `none-` |
Ask: **Is this motion reacting to the user, or is the system speaking?**
| Motion Type | Best Choice | Why | |-------------|-------------|-----| | User-driven (drag, flick, gesture) | Spring | Survives interruption, preserves velocity | | System-driven (state change, feedback) | Easing | Clear start/end, predictable timing | | Time representation (progress, loading) | Linear | 1:1 relationship between time and progress | | High-frequency (typing, fast toggles) | None | Animation adds noise, feels slower |
Gesture-driven motion (drag, flick, swipe) must use springs.
**Fail:**
<motion.div
drag="x"
transition={{ duration: 0.3, ease: "easeOut" }}
/>**Pass:**
<motion.div
drag="x"
transition={{ type: "spring", stiffness: 500, damping: 30 }}
/>Motion that can be interrupted must use springs.
**Fail:**
// User can click again mid-animation
<motion.div
animate={{ x: isOpen ? 200 : 0 }}
transition={{ duration: 0.3 }}
/>**Pass:**
<motion.div
animate={{ x: isOpen ? 200 : 0 }}
transition={{ type: "spring", stiffness: 400, damping: 25 }}
/>When velocity matters, use springs to preserve input energy.
**Fail:**
// Fast flick and slow flick animate identically
onDragEnd={(e, info) => {
animate(target, { x: 0 }, { duration: 0.3 });
}}**Pass:**
// Fast flick moves faster than slow flick
onDragEnd={(e, info) => {
animate(target, { x: 0 }, {
type: "spring",
velocity: info.velocity.x,
});
}}Spring parameters must be balanced; avoid excessive oscillation.
**Fail:**
transition={{
type: "spring",
stiffness: 1000,
damping: 5, // Too low - excessive bounce
}}**Pass:**
transition={{
type: "spring",
stiffness: 500,
damping: 30, // Balanced - settles quickly
}}System-initiated state changes should use easing curves.
**Fail:**
// Toast notification using spring
<motion.div
animate={{ y: 0 }}
transition={{ type: "spring" }}
/>
// Feels restless for a simple announcement**Pass:**
<motion.div
animate={{ y: 0 }}
transition={{ duration: 0.2, ease: "easeOut" }}
/>Entrances must use ease-out (arrive fast, settle gently).
**Fail:**
.modal-enter {
animation-timing-function: ease-in;
}**Pass:**
.modal-enter {
animation-timing-function: ease-out;
}Exits must use ease-in (build momentum before departure).
**Fail:**
.modal-exit {
animation-timing-function: ease-out;
}**Pass:**
.modal-exit {
animation-timing-function: ease-in;
}View/mode transitions use ease-in-out for neutral attention.
**Pass:**
.page-transition {
animation-timing-function: ease-in-out;
}Linear easing only for progress bars and time representation.
**Fail:**
.card-slide {
transition: transform 200ms linear; /* Mechanical feel */
}**Pass:**
.progress-bar {
transition: width 100ms linear; /* Honest time representation */
}Press and hover interactions: 120-180ms.
**Fail:**
.button:hover {
transition: background-color 400ms;
}**Pass:**
.button:hover {
transition: background-color 150ms;
}Small state changes: 180-260ms.
**Pass:**
.toggle {
transition: transform 200ms ease;
}User-initiated animations must not exceed 300ms.
**Fail:**
<motion.div transition={{ duration: 0.5 }} />**Pass:**
<motion.div transition={{ duration: 0.25 }} />If animation feels slow, shorten duration before adjusting curve.
**Fail (common mistake):**
/* Trying to fix slowness with sharper curve */
.element {
transition: 400ms cubic-bezier(0, 0.9, 0.1, 1);
}**Pass:**
/* Fix slowness with shorter duration */
.element {
transition: 200ms ease-out;
}High-frequency interactions should have no animation.
**Fail:**
// Animated on every keystroke
function SearchInput() {
return (
<motion.div animate={{ scale: [1, 1.02, 1] }}>
<input onChange={handleSearch} />
</motion.div>
);
}**Pass:**
function SearchInput() {
return <input onChange={handleSearch} />;
}Keyboard navigation should be instant, no animation.
**Fail:**
function Menu() {
return items.map(item => (
<motion.li
whileFocus={{ scale: 1.05 }}
transition={{ duration: 0.2 }}
/>
));
}**Pass:**
function Menu() {
return items.map(item => (
<li className={styles.menuItem} /> // CSS :focus-visible only
));
}#
A skill file based on the articles written on userinterface.wiki. Designed for designers and engineers to help them build better user interfaces.
Audit animation code against Disney's 12 principles adapted for web. Use when reviewing motion, implementing animations, or…
Audit Web Audio API code for sound synthesis best practices. Use when reviewing procedural audio, implementing UI sounds, or…
Audit Motion/Framer Motion code for AnimatePresence best practices. Use when reviewing exit animations, modals, or presence…
Build icon components where any icon morphs into any other through SVG line transformation. Use when asked to "create morphing…
Audit CSS for pseudo-element best practices and View Transitions API usage. Use when reviewing hover effects, decorative layers,…
Audit UI code for audio feedback best practices. Use when reviewing sound implementation, checking audio UX decisions, or…