Animations

Create performant web animations with proper accessibility and timing.

Safety Notice

This listing is from the official public ClawHub registry. Review SKILL.md and referenced scripts before running.

Copy this and send it to your AI assistant to learn

Install skill "Animations" with this command: npx skills add ivangdavila/animations

GPU-Accelerated Properties

Only these properties animate on the compositor thread (60fps):

PropertyUse
transformMove, rotate, scale (translateX, rotate, scale)
opacityFade in/out

Everything else triggers layout or paint. Avoid animating:

  • width, height, margin, padding (layout thrashing)
  • top, left, right, bottom (use transform instead)
  • border-width, font-size (expensive reflows)
/* ❌ Triggers layout every frame */
.slide { left: 100px; transition: left 0.3s; }

/* ✅ GPU accelerated */
.slide { transform: translateX(100px); transition: transform 0.3s; }

Reduced Motion

~5% of users experience vestibular disorders (dizziness, nausea from motion).

/* Only animate if user hasn't requested reduced motion */
@media (prefers-reduced-motion: no-preference) {
  .animated { animation: slide-in 0.5s ease-out; }
}

/* Or disable for those who requested it */
@media (prefers-reduced-motion: reduce) {
  *, *::before, *::after {
    animation-duration: 0.01ms !important;
    animation-iteration-count: 1 !important;
    transition-duration: 0.01ms !important;
  }
}

Keep subtle fades and color changes even with reduced motion. Remove parallax, bouncing, infinite loops.

Timing Functions

EasingUse case
ease-outElements entering view (appears responsive)
ease-inElements exiting view (accelerates away)
ease-in-outElements moving within view
linearOnly for spinners, progress bars, color cycling
/* Custom bounce */
transition: transform 0.4s cubic-bezier(0.68, -0.55, 0.265, 1.55);

/* Material Design standard */
transition: transform 0.3s cubic-bezier(0.4, 0, 0.2, 1);

Duration Guidelines

TypeDuration
Micro-interactions (hover, focus)100-200ms
Transitions (modals, dropdowns)200-300ms
Page transitions300-500ms
Complex choreography500-1000ms max

Anything over 500ms feels sluggish. Shorter is usually better.

CSS Transitions vs Animations

Transitions: A to B state changes

.button { transform: scale(1); transition: transform 0.2s ease-out; }
.button:hover { transform: scale(1.05); }

Animations: Multi-step, auto-play, looping

@keyframes fadeSlideIn {
  0% { opacity: 0; transform: translateY(20px); }
  100% { opacity: 1; transform: translateY(0); }
}
.card { animation: fadeSlideIn 0.5s ease-out forwards; }

Use transitions for hover/focus states. Use animations for on-load effects and sequences.

will-change

Only use as optimization when you have specific performance problems:

/* ✅ Apply before animation starts, remove after */
.card:hover { will-change: transform; }
.card { will-change: auto; }

/* ❌ Never apply globally */
* { will-change: transform, opacity; }  /* Wastes GPU memory */

Transition Property Specificity

/* ❌ Animates everything including unintended properties */
.card { transition: all 0.3s; }

/* ✅ Only animates what you need */
.card { transition: transform 0.3s, box-shadow 0.3s; }

all can cause unexpected animations on color, background, border changes.

React/Framework Traps

Exit animations require AnimatePresence:

/* ❌ Exit animation never plays */
{isVisible && <motion.div exit={{ opacity: 0 }} />}

/* ✅ Wrap conditional rendering */
<AnimatePresence>
  {isVisible && <motion.div exit={{ opacity: 0 }} />}
</AnimatePresence>

Stable keys for list animations:

/* ❌ Index keys cause erratic animations */
{items.map((item, i) => <li key={i}>{item}</li>)}

/* ✅ Stable IDs */
{items.map(item => <li key={item.id}>{item.text}</li>)}

AutoAnimate parent must be unconditional:

/* ❌ Ref can't attach to conditional element */
{showList && <ul ref={parent}>...</ul>}

/* ✅ Parent always renders, children are conditional */
<ul ref={parent}>{showList && items.map(...)}</ul>

Library Selection

LibrarySizeBest for
CSS only0kbHover states, simple transitions
AutoAnimate3kbLists, accordions, toasts (90% of UI animations)
Motion22kbGestures, physics, scroll animations, complex choreography
GSAP60kbTimelines, creative animation, scroll-triggered sequences

Start with CSS. Add AutoAnimate for list animations. Only add Motion/GSAP for complex needs.

Common Mistakes

  • Animating width/height instead of scale—causes layout thrashing
  • Infinite animations without pause control—no way to stop
  • Same easing for enter and exit—use ease-out for enter, ease-in for exit
  • Ignoring prefers-reduced-motion—causes physical discomfort
  • Duration over 500ms—feels sluggish
  • transition: all catching unintended properties
  • Missing AnimatePresence for exit animations in React

Source Transparency

This detail page is rendered from real SKILL.md content. Trust labels are metadata-based hints, not a safety guarantee.

Related Skills

Related by shared tags or category signals.

General

Charging Ledger

充电记录账本 - 从截图提取充电信息并记录,支持按周、月查询汇总。**快速暗号**: 充电记录、充电账本、充电汇总。**自然触发**: 记录充电、查询充电费用、充电统计。

Registry SourceRecently Updated
General

qg-skill-sync

从团队 Git 仓库同步最新技能到本机 OpenClaw。支持首次设置、定时自动更新、手动同步和卸载。当用户需要同步技能、设置技能同步、安装或更新团队技能,或提到「技能同步」「同步技能」时使用。

Registry SourceRecently Updated
General

Ad Manager

广告投放管理 - 自动管理广告投放、优化ROI、生成报告。适合:营销人员、电商运营。

Registry SourceRecently Updated