UI Animation — Complete Guide
This skill covers the full lifecycle of UI animations: from identifying where animations add value, through implementation with best practices, to reviewing and optimizing existing animations.
1. Animation Vocabulary & Taxonomy
Motion Primitives
| Primitive |
CSS / JS Property |
Use Case |
| Fade |
opacity |
Entrance/exit, overlays, skeleton → content |
| Slide |
translateX / translateY |
Page transitions, drawers, toasts |
| Scale |
scale / transform: scale() |
Modals, cards, hover emphasis |
| Rotate |
rotate / transform: rotate() |
Loading spinners, icon state change |
| Morph |
clip-path, d (SVG path) |
Shape transitions, creative reveals |
| Color Shift |
background-color, color, fill |
State feedback (success/error), theming |
| Blur |
filter: blur() |
Depth of field, focus transitions |
| Stagger |
Sequential delay per child |
List/grid entrance, cascade effects |
Easing Reference
| Name |
CSS Value |
Personality |
| Ease Out Cubic |
cubic-bezier(0.33, 1, 0.68, 1) |
Snappy, responsive (recommended default) |
| Ease In Out Quart |
cubic-bezier(0.76, 0, 0.24, 1) |
Elegant, polished transitions |
| Spring |
cubic-bezier(0.34, 1.56, 0.64, 1) |
Playful, bouncy, delightful |
| Linear |
linear |
Only for infinite loops (spinners, marquees) |
Duration Guidelines
- Micro-interactions (hover, press):
100–200ms
- Small transitions (toggle, tab switch):
200–300ms
- Medium transitions (modal open, slide-in):
300–500ms
- Large/page transitions:
400–700ms
- Never exceed
1000ms for functional animations
2. Finding Animation Opportunities
When reviewing a UI, systematically scan for these high-impact animation opportunities:
High Priority (Always Animate)
- Page/Route Transitions — Fade + subtle slide between pages
- Modal & Dialog — Scale from 0.95 → 1.0 + backdrop fade
- Loading States — Skeleton shimmer, spinner, progress bar
- Toast / Notification — Slide in from edge + auto-dismiss fade
- Navigation State — Active tab indicator slide, hamburger → X morph
Medium Priority (Strong UX Lift)
- List/Grid Item Entrance — Staggered fade-up on scroll-into-view
- Accordion / Collapse — Smooth height + opacity transition
- Hover & Focus States — Scale, shadow lift, color shift on interactive elements
- Form Validation — Shake on error, checkmark on success
- Data Visualization — Chart bars/lines animate from zero on load
Low Priority (Polish & Delight)
- Scroll-Linked Parallax — Background layers at different scroll speeds
- Cursor Effects — Custom cursor, magnetic buttons
- Easter Eggs — Confetti on achievement, playful 404 pages
- Micro-copy Transitions — Button label swap ("Save" → "Saved ✓")
Anti-Patterns to Avoid
- ❌ Animating layout-triggering properties (
width, height, top, left) — use transform instead
- ❌ Animation on every scroll event without
IntersectionObserver or throttling
- ❌ Motion that blocks user input or slows task completion
- ❌ Inconsistent easing across the same app
- ❌ Ignoring
prefers-reduced-motion accessibility setting
3. Implementation Patterns
CSS Transitions (Simple State Changes)
.card {
transition: transform 300ms cubic-bezier(0.33, 1, 0.68, 1),
box-shadow 300ms cubic-bezier(0.33, 1, 0.68, 1);
}
.card:hover {
transform: translateY(-4px) scale(1.02);
box-shadow: 0 12px 32px rgba(0, 0, 0, 0.12);
}
CSS Keyframes (Multi-Step Animations)
@keyframes fadeInUp {
from {
opacity: 0;
transform: translateY(16px);
}
to {
opacity: 1;
transform: translateY(0);
}
}
.animate-in {
animation: fadeInUp 400ms cubic-bezier(0.33, 1, 0.68, 1) both;
}
Staggered List Entrance
.list-item {
animation: fadeInUp 400ms cubic-bezier(0.33, 1, 0.68, 1) both;
}
.list-item:nth-child(1) { animation-delay: 0ms; }
.list-item:nth-child(2) { animation-delay: 60ms; }
.list-item:nth-child(3) { animation-delay: 120ms; }
/* Or use: animation-delay: calc(var(--i) * 60ms); with CSS custom property */
Accessibility — Reduced Motion
@media (prefers-reduced-motion: reduce) {
*, *::before, *::after {
animation-duration: 0.01ms !important;
animation-iteration-count: 1 !important;
transition-duration: 0.01ms !important;
scroll-behavior: auto !important;
}
}
JavaScript — Intersection Observer for Scroll Animations
const observer = new IntersectionObserver((entries) => {
entries.forEach(entry => {
if (entry.isIntersecting) {
entry.target.classList.add('animate-in');
observer.unobserve(entry.target);
}
});
}, { threshold: 0.1 });
document.querySelectorAll('.animate-on-scroll').forEach(el => observer.observe(el));
React / Framer Motion Pattern
<motion.div
initial={{ opacity: 0, y: 20 }}
animate={{ opacity: 1, y: 0 }}
exit={{ opacity: 0, y: -10 }}
transition={{ duration: 0.35, ease: [0.33, 1, 0.68, 1] }}
>
{children}
</motion.div>
SwiftUI Pattern
withAnimation(.spring(response: 0.4, dampingFraction: 0.75)) {
isExpanded.toggle()
}
4. Reviewing & Optimizing Animations
Performance Checklist
Quality Checklist
Common Issues & Fixes
| Issue |
Symptom |
Fix |
| Jank / dropped frames |
Stuttering on mid-range devices |
Move to transform/opacity only |
| Flash of unstyled content |
Elements visible before animation starts |
Use animation-fill-mode: both |
| Competing animations |
Multiple animations fight for same property |
Use animation-composition or sequence |
| Overshooting spring |
Element bounces too aggressively |
Increase dampingFraction or reduce overshoot |
| Scroll-linked jank |
Parallax causes frame drops |
Use CSS scroll-timeline or throttle with rAF |
5. Animation Libraries Reference
| Library |
Platform |
Best For |
| Framer Motion |
React |
Declarative layout animations, gestures |
| GSAP |
Vanilla JS |
Complex timelines, scroll-triggered sequences |
| Lottie |
Web / iOS / Android |
After Effects → code, icon & illustration animations |
| CSS (native) |
All |
Simple transitions, keyframes, scroll-driven |
| SwiftUI .animation |
iOS / macOS |
Native spring physics, matched geometry |
| Rive |
Cross-platform |
Interactive, state-machine driven animations |
1---2name: ui-animation3description: Uçtan uca kullanıcı arayüzü (UI) animasyon yeteneği: web ve mobil animasyonlar için terminoloji, optimizasyon ve kod incelemesi.4---56# UI Animation — Complete Guide78This skill covers the full lifecycle of UI animations: from identifying where animations add value, through implementation with best practices, to reviewing and optimizing existing animations.910---1112## 1. Animation Vocabulary & Taxonomy1314### Motion Primitives15| Primitive | CSS / JS Property | Use Case |16|---|---|---|17| **Fade** | `opacity` | Entrance/exit, overlays, skeleton → content |18| **Slide** | `translateX / translateY` | Page transitions, drawers, toasts |19| **Scale** | `scale / transform: scale()` | Modals, cards, hover emphasis |20| **Rotate** | `rotate / transform: rotate()` | Loading spinners, icon state change |21| **Morph** | `clip-path`, `d` (SVG path) | Shape transitions, creative reveals |22| **Color Shift** | `background-color`, `color`, `fill` | State feedback (success/error), theming |23| **Blur** | `filter: blur()` | Depth of field, focus transitions |24| **Stagger** | Sequential delay per child | List/grid entrance, cascade effects |2526### Easing Reference27| Name | CSS Value | Personality |28|---|---|---|29| Ease Out Cubic | `cubic-bezier(0.33, 1, 0.68, 1)` | Snappy, responsive (recommended default) |30| Ease In Out Quart | `cubic-bezier(0.76, 0, 0.24, 1)` | Elegant, polished transitions |31| Spring | `cubic-bezier(0.34, 1.56, 0.64, 1)` | Playful, bouncy, delightful |32| Linear | `linear` | Only for infinite loops (spinners, marquees) |3334### Duration Guidelines35- **Micro-interactions** (hover, press): `100–200ms`36- **Small transitions** (toggle, tab switch): `200–300ms`37- **Medium transitions** (modal open, slide-in): `300–500ms`38- **Large/page transitions**: `400–700ms`39- **Never exceed `1000ms`** for functional animations4041---4243## 2. Finding Animation Opportunities4445When reviewing a UI, systematically scan for these high-impact animation opportunities:4647### High Priority (Always Animate)481. **Page/Route Transitions** — Fade + subtle slide between pages492. **Modal & Dialog** — Scale from 0.95 → 1.0 + backdrop fade503. **Loading States** — Skeleton shimmer, spinner, progress bar514. **Toast / Notification** — Slide in from edge + auto-dismiss fade525. **Navigation State** — Active tab indicator slide, hamburger → X morph5354### Medium Priority (Strong UX Lift)556. **List/Grid Item Entrance** — Staggered fade-up on scroll-into-view567. **Accordion / Collapse** — Smooth height + opacity transition578. **Hover & Focus States** — Scale, shadow lift, color shift on interactive elements589. **Form Validation** — Shake on error, checkmark on success5910. **Data Visualization** — Chart bars/lines animate from zero on load6061### Low Priority (Polish & Delight)6211. **Scroll-Linked Parallax** — Background layers at different scroll speeds6312. **Cursor Effects** — Custom cursor, magnetic buttons6413. **Easter Eggs** — Confetti on achievement, playful 404 pages6514. **Micro-copy Transitions** — Button label swap ("Save" → "Saved ✓")6667### Anti-Patterns to Avoid68- ❌ Animating layout-triggering properties (`width`, `height`, `top`, `left`) — use `transform` instead69- ❌ Animation on every scroll event without `IntersectionObserver` or throttling70- ❌ Motion that blocks user input or slows task completion71- ❌ Inconsistent easing across the same app72- ❌ Ignoring `prefers-reduced-motion` accessibility setting7374---7576## 3. Implementation Patterns7778### CSS Transitions (Simple State Changes)79```css80.card {81 transition: transform 300ms cubic-bezier(0.33, 1, 0.68, 1),82 box-shadow 300ms cubic-bezier(0.33, 1, 0.68, 1);83}84.card:hover {85 transform: translateY(-4px) scale(1.02);86 box-shadow: 0 12px 32px rgba(0, 0, 0, 0.12);87}88```8990### CSS Keyframes (Multi-Step Animations)91```css92@keyframes fadeInUp {93 from {94 opacity: 0;95 transform: translateY(16px);96 }97 to {98 opacity: 1;99 transform: translateY(0);100 }101}102103.animate-in {104 animation: fadeInUp 400ms cubic-bezier(0.33, 1, 0.68, 1) both;105}106```107108### Staggered List Entrance109```css110.list-item {111 animation: fadeInUp 400ms cubic-bezier(0.33, 1, 0.68, 1) both;112}113.list-item:nth-child(1) { animation-delay: 0ms; }114.list-item:nth-child(2) { animation-delay: 60ms; }115.list-item:nth-child(3) { animation-delay: 120ms; }116/* Or use: animation-delay: calc(var(--i) * 60ms); with CSS custom property */117```118119### Accessibility — Reduced Motion120```css121@media (prefers-reduced-motion: reduce) {122 *, *::before, *::after {123 animation-duration: 0.01ms !important;124 animation-iteration-count: 1 !important;125 transition-duration: 0.01ms !important;126 scroll-behavior: auto !important;127 }128}129```130131### JavaScript — Intersection Observer for Scroll Animations132```javascript133const observer = new IntersectionObserver((entries) => {134 entries.forEach(entry => {135 if (entry.isIntersecting) {136 entry.target.classList.add('animate-in');137 observer.unobserve(entry.target);138 }139 });140}, { threshold: 0.1 });141142document.querySelectorAll('.animate-on-scroll').forEach(el => observer.observe(el));143```144145### React / Framer Motion Pattern146```jsx147<motion.div148 initial={{ opacity: 0, y: 20 }}149 animate={{ opacity: 1, y: 0 }}150 exit={{ opacity: 0, y: -10 }}151 transition={{ duration: 0.35, ease: [0.33, 1, 0.68, 1] }}152>153 {children}154</motion.div>155```156157### SwiftUI Pattern158```swift159withAnimation(.spring(response: 0.4, dampingFraction: 0.75)) {160 isExpanded.toggle()161}162```163164---165166## 4. Reviewing & Optimizing Animations167168### Performance Checklist169- [ ] Only `transform` and `opacity` are animated (GPU-composited, no layout/paint)170- [ ] No forced synchronous layout (read then write in the same frame)171- [ ] `will-change` used sparingly and only on elements about to animate172- [ ] Animations are removed/paused when off-screen173- [ ] `requestAnimationFrame` used for JS-driven animations (not `setInterval`)174175### Quality Checklist176- [ ] Consistent easing curve across the entire application177- [ ] Duration feels natural — not too fast (jarring) or too slow (sluggish)178- [ ] Entrance and exit animations are paired (don't just fade in without fade out)179- [ ] Stagger delays are uniform (40–80ms between items)180- [ ] `prefers-reduced-motion` is respected with graceful fallback181182### Common Issues & Fixes183| Issue | Symptom | Fix |184|---|---|---|185| Jank / dropped frames | Stuttering on mid-range devices | Move to `transform`/`opacity` only |186| Flash of unstyled content | Elements visible before animation starts | Use `animation-fill-mode: both` |187| Competing animations | Multiple animations fight for same property | Use `animation-composition` or sequence |188| Overshooting spring | Element bounces too aggressively | Increase `dampingFraction` or reduce overshoot |189| Scroll-linked jank | Parallax causes frame drops | Use CSS `scroll-timeline` or throttle with rAF |190191---192193## 5. Animation Libraries Reference194195| Library | Platform | Best For |196|---|---|---|197| **Framer Motion** | React | Declarative layout animations, gestures |198| **GSAP** | Vanilla JS | Complex timelines, scroll-triggered sequences |199| **Lottie** | Web / iOS / Android | After Effects → code, icon & illustration animations |200| **CSS (native)** | All | Simple transitions, keyframes, scroll-driven |201| **SwiftUI .animation** | iOS / macOS | Native spring physics, matched geometry |202| **Rive** | Cross-platform | Interactive, state-machine driven animations |