协作头脑风暴
brainstorming
在实现前澄清需求、探索设计选择,并形成清晰的开发方向。
ui-animation【开发与工程】Builds, reviews, and measures UI motion, including springs, gestures, scroll effects, curve fitting from recordings, and sparse interface sound. Use when asked to "add animation", "match this easing", "reverse engineer this motion", "add a click sound", or find animation opportunities.
独立 GitHub 快照 · 自动分类 · 以原作者文档为准
ui-design Direction mode), auditing a whole page's UI quality (use ui-design Audit mode), or named text-effect specs (use the external animate-text skill where installed).| File | Read when |
|---|---|
| references/decision-framework.md | Default: deciding whether/why to animate, picking easing character; also the Discovery sweep ("where should this animate") |
| references/spring-animations.md | Spring physics, Motion useSpring, configuring spring params, Apple damping/response values, asymmetric open/close character, interruption mechanics |
| references/component-patterns.md | Buttons, toasts, crossfades, list stagger and removal, hover, step forms, Motion layout morphs and auto height, 3D |
| references/clip-path-techniques.md | clip-path for reveals, tabs, hold-to-delete, comparison sliders |
| references/gesture-drag.md | Drag, swipe-to-dismiss, momentum, pointer capture, velocity handoff, momentum projection, rotary/knob drag, detents, carousel touch-action |
| references/scroll-animations.md | Scroll-triggered reveals, scrubbed/scroll-driven animation (animation-timeline, useScroll), parallax, sticky scrollytelling, and when a scroll animation shouldn't exist |
| references/performance-deep-dive.md | Jank, CSS vs JS, WAAPI, CSS variables trap, Framer Motion caveats |
| references/debugging-symptoms.md | An animation feels off and the cause isn't named: symptom-indexed tables for sluggish, robotic, cheap, jumpy, and misfiring motion |
| references/svg-animation.md | Animating vector art: line drawing (stroke-dashoffset), SVG transform-origin traps, path morphing, shakes, ambient life |
| references/review-format.md | Reviewing animation code: ten standards (each with flag-on-sight triggers), Before/After/Why table, Block/Approve verdict |
| references/contextual-animations.md | Contextual icon swaps, word-level stagger entrances, peripheral de-emphasis, fixed-offset exits |
| references/transition-recipes.md | Installing a CSS transition: container morph, card resize, badge, dropdown and tooltip (with library origin variables), modal (with @starting-style entry), panel and drawer, page slide, icon swap, number pop-in, odometer roll, text swap, success, avatar hover, error shake |
| references/measurement-guide.md | Reverse-engineer: what to measure, eye vs script, reading metrics.json, choosing an ROI |
| references/curve-fitting.md | Reverse-engineer: reading fit_curves.py output, spring vs bezier, judging fit error, asymmetric open/close |
| references/code-output.md | Reverse-engineer: emitting code for CSS, Motion/Framer Motion, SwiftUI, React Native, UIKit |
| references/choreography.md | Reverse-engineer: multi-element/multi-phase motion: staggers, blur-before-move, per-edge settling |
| references/vocabulary.md | Naming a motion effect the user describes vaguely ("what's it called when...") |
| references/interface-sfx.md | Click sounds, interface audio, UI SFX, haptic-plus-sound, or "why is the web afraid of sound" |
requestAnimationFrame); under load CSS stays smooth while JS drops frames.:active at 0ms and set touch-action: manipulation.@starting-style for DOM entry; fall back to a data-mounted attribute where unsupported.filter: blur(2px) hides rough crossfades between swapped content.transform and opacity only; they skip layout and paint.color, background-color, and opacity are acceptable.width, height, top, left); they trigger layout recalc every frame. (Exception: a deliberate container tween, see the card-resize and container-morph recipes.)transition: all; it animates unintended properties and silently adopts future ones. List them explicitly.filter animation for core interactions; if unavoidable keep blur ≤ 20px (heavy blur is expensive, especially in Safari).<g> wrapper with transform-box: fill-box; transform-origin: center; without it they rotate/scale around the canvas origin. Line drawing, path morphing, and the Motion SVG origin override live in references/svg-animation.md.transform: scale() also scales children (icons, text, borders scale proportionally), unlike width/height: a feature for press feedback, but account for it when an inner element must stay fixed-size.[data-theme-switching] * { transition: none !important }), or every themed property animates at once. Force a reflow (void document.body.offsetHeight) after the flip and remove the override on the next frame, or use next-themes disableTransitionOnChange.| Element | Duration | Easing |
|---|---|---|
| Button press feedback | 100-160ms | cubic-bezier(0.22, 1, 0.36, 1) |
| Tooltips, small popovers | 125-200ms | ease-out or enter curve |
| Dropdowns, selects | 150-250ms | cubic-bezier(0.22, 1, 0.36, 1) |
| Modals, drawers | 200-350ms | cubic-bezier(0.22, 1, 0.36, 1) |
| Move/slide on screen | 200-300ms | cubic-bezier(0.25, 1, 0.5, 1) |
| Page transitions | 250-400ms | enter or move curve |
| Hover (colour/opacity), one control | 200ms | ease |
| Hover (transform/scale) | 100-150ms | enter curve |
| Illustrative/marketing | Up to 1000ms | Spring or custom |
Keep routine UI under 300ms; scale duration with distance (a full-screen slide can exceed 300ms, a 6px tooltip shift stays under 150ms).
Named curves
cubic-bezier(0.22, 1, 0.36, 1) for entrances and transform-based hovercubic-bezier(0.25, 1, 0.5, 1) for slides, drawers, panelscubic-bezier(0.32, 0.72, 0, 1) (extremely steep start; the reason its 500ms doesn't read as slow)cubic-bezier(0.19, 1, 0.22, 1) for dramatic reveals, card hovers, text revealscubic-bezier(0.25, 0.46, 0.45, 0.94) for button press feedbackcubic-bezier(0.645, 0.045, 0.355, 1) for back-and-forth movement that stays on screenAvoid ease-in for UI: it starts slow, so the element lags the user's action and feels sluggish. Prefer custom curves from easing.dev over built-in ease/ease-out, whose gentle acceleration reads soft, not decisive.
Match the UI element first, then pick the recipe from references/transition-recipes.md:
| UI pattern | Recipe |
|---|---|
| Trigger + floating dot/count | Notification badge |
| Trigger grows into the surface it opens | Container morph |
| Trigger + anchored surface | Menu dropdown |
| Centred surface on top of page | Modal dialog |
| Panel sliding into existing container | Panel reveal |
| List ↔ detail or wizard steps | Page side-by-side slides |
| Element dimension changes | Card resize |
| Text updating in place | Text state swap |
| Two icons in same slot | Icon swap |
| Number arriving on its own | Number pop-in |
| Number the user is driving | Odometer digit roll |
| Confirmation / success moment | Success celebration |
| Hovering item in horizontal stack | Avatar group hover |
| Form validation error | Error state shake |
Prefer lower-overhead transitions (CSS-only) unless the design requires JS orchestration.
transform-origin at the trigger (modals stay center), dialog/menu entrances from scale(0.9-0.96) not scale(0) (small popovers at the low end, full dialogs at the high end: a large surface already travels far in absolute pixels), and 30-50ms staggers (total under 300ms, most important element leading). Full rules and code in references/transition-recipes.md and references/contextual-animations.md.@media (hover: hover) and (pointer: fine), or touch devices replay hover on tap. Inspect the generated CSS before adding a gate; Tailwind v4 already wraps hover: in @media (hover: hover).IntersectionObserver; they burn GPU even when invisible.will-change only during heavy motion and only for transform/opacity; remove it after. Each promotion costs compositor memory; permanent promotion across many elements is worse than none.transform directly on the moving element.x/y values are the default for axis movement and drag (they bypass React re-renders). Use a full transform string when one owner must combine multiple transform functions, interop with non-Motion code, or survive a busy main thread: the shorthands run on requestAnimationFrame and drop frames when motion coincides with navigation, data loading, or hydration; CSS/WAAPI stay smooth there.transitionend.High-signal failures not covered above:
linear and no duration is correct there, and only there.@media (prefers-reduced-motion) block, so the CSS gate passes review while spatial travel still plays. Wrap the app in <MotionConfig reducedMotion="user"> or branch on useReducedMotion(). The opposite overcorrection, a global * { transition: none !important } under reduce, also strips the opacity and colour feedback that reduced motion keeps.framer-motion for new work: the package is now motion and React imports come from motion/react. The old package still resolves, so a mixed codebase compiles while shipping two copies of the library.Copy and track:
Animation progress:
- [ ] Step 1: Decide whether the interaction should animate
- [ ] Step 2: Choose purpose, easing, and duration
- [ ] Step 3: Pick the implementation style
- [ ] Step 4: Load the relevant component or technique reference
- [ ] Step 5: Validate timing, interruption, and device behavior
Produce evidence for each check (DevTools observations, not "looks fine"):
width, height, top, left) and transition: all.transform-origin issues invisible at full speed.will-change is toggled around animations, not permanently set, and looping animations pause off-screen.prefers-reduced-motion: replace spatial travel with immediate state changes or restrained fades. Pause looping decorations with animation-play-state: paused (do not yank them with display: none). Keep explicit user-triggered feedback. Exercise the same task in that mode.For "where should this animate", run the Discovery sweep in references/decision-framework.md. Report opportunities supported by purpose and usage frequency, plus the rejected ones. Implement a suggestion only when implementation is in scope.
Use this branch to measure an existing animation from a screen recording, then emit code and a handoff spec that reproduce it. The scripts under scripts/ are the canonical, deterministic path; run them rather than reconstructing their logic.
Resolve every scripts/ command below relative to the installed skill directory, not the application working directory.
Dependencies: ffmpeg for frame extraction (brew install ffmpeg); Python with pip install opencv-python numpy scipy for tracking and curve fitting. Degrades gracefully: with only ffmpeg you can extract frames and reason visually; tracking and fitting need the Python packages.
Reverse-engineer progress:
- [ ] Step 1: Extract frames + contact sheet (per direction if open differs from close)
- [ ] Step 2: Vision pass: identify element, effects, phases
- [ ] Step 3: Decide precision (eye-only vs scripted)
- [ ] Step 4: Track motion and fit curves (if escalating)
- [ ] Step 5: Annotate choreography (delays, asymmetry)
- [ ] Step 6: Emit code for the target(s)
- [ ] Step 7: Validate against the recording
python3 scripts/extract_frames.py <video> <outdir>. Trim to just the transition with --start/--duration; if the interaction has both an open and a close, trim two windows and run the pipeline once per direction (they are almost never mirror images). Match --fps to the source (probe with ffprobe), never sampling above the source rate. Open contact_sheet.png first.references/measurement-guide.md.python3 scripts/track_motion.py <outdir> for metrics.json (pass --bbox X,Y,W,H to isolate one element), then python3 scripts/fit_curves.py <outdir>/metrics.json for spring params, cubic-bezier, and per-property fit error. Pass the same --fps you extracted with. Read references/curve-fitting.md to pick the model; high error on both means multi-phase motion (split and fit each segment).references/choreography.md. Build the timing-offset table (when each property starts and settles); lead/lag gaps and over-stretch carry more feel than any single curve.references/code-output.md for the target. Keep movement on transform/opacity. Emit two transitions when open and close differ, plus the consolidated handoff spec so it can be implemented without the video.extract_frames.py, and compare contact sheets side by side. Slow to 0.1x to confirm phase order and over-stretch survive. Confirm the code only animates transform, opacity, and filter.Reverse-engineer gotchas:
fit_curves.py defaults to --fps 30: extract at 60 but fit at the default and every duration_ms doubles while fitted stiffness drops to a quarter. Always pass the extraction fps to the fit.metrics.json. Probe and match the source rate.references/choreography.md). Treat a fit error above 0.08 as suspect.product-design: which states exist, what an action affects, and whether it is reversible. Route here first when a gesture replaces a control, since swipe-to-delete and hold-to-confirm change what the user can do before they change how it moves.ui-design Direction mode: visual direction, palettes, typography; settle the visual system before tuning motion.ui-design Audit mode: page/feature-level UI quality audit. Motion craft and fixes belong here.animate-text skill where installed: curated named text effects (typewriter, line reveal, stagger builds) with exact JSON specs.Maintenance only: evals/ holds the regression scenarios (evals.json, and discovery-mode.json for Discovery routing and the gate) and their fixtures; none of it loads during a user task.