AGENT SKILL

产品 UI 动效设计

ui-motion

设计并构建手感恰当的产品 UI 动效:转场、进入/退出、面板、抽屉、菜单、提示气泡(toast)、列表重排、共享元素移动、悬停/按压反馈、加载到内容的过渡、手势。涵盖时长与缓动数值、弹簧动画、动作编排、什么该动什么不该动、减少动态效果(reduced motion)、性能,以及一个帧序列条工具(scripts/strip.mjs),可逐帧捕获转场过程,让你在宣布完成之前能亲眼看到效果。适用于任何 React/CSS/SwiftUI 动画或“让这个感觉更流畅/更灵敏/更精致”的请求,以及任何 framer-motion / motion / CSS transition / keyframes / View Transitions / withAnimation 相关工作。不适用于视频(motion-reel、film-studio)或纯性能修复。

License 许可
Apache-2.0
最近更新
2026-11-15
Stars
★ 1
Forks
0

01 前言 Front Matter

name
ui-motion
description
Design and build product-UI motion that feels right: transitions, enter/exit, panels, sheets, menus, toasts, list reorder, shared-element moves, hover/press feedback, loading-to-content, gestures. Covers timing and easing numbers, springs, choreography, what moves and what doesn't, reduced motion, performance, and a frame-strip tool (scripts/strip.mjs) that captures a transition frame by frame so you can SEE it before calling it done. Use for ANY React/CSS/ SwiftUI animation or "make this feel smoother / snappier / more polished" request, any framer-motion / motion / CSS transition / keyframes / View Transitions / withAnimation work. Not for videos (motion-reel, film-studio) or perf-only fixes.

02 资源文件 3

03 SKILL.md 正文

ui-motion

Motion in a product exists to explain change: where something came from, where it went, what caused it. If an animation doesn't answer one of those, cut it. The rest of this file is the numbers and the review loop that make the remaining motion feel deliberate.

The loop (do all four, every time)

  1. Write the beat sheet first, in a comment or the PR: trigger → what moves → from where → to where → how long → easing → what happens on interrupt. One line per element.
  2. Build it with the numbers below, in the project's existing motion tokens/library. Read the design system first (grep -r "cubic-bezier\|transition\|spring\|duration" src); reuse its tokens instead of inventing new ones. If it has none, add a small token set.
  3. Look at it frame by frame with scripts/strip.mjs (below) and read sheet.png. You cannot judge motion from code. Check: does frame 1 already show movement (no dead lag)? Is the settle visible but short? Do things that should move together actually move together? Any flash, jump, layout shift, or element popping in at the end?
  4. Check the edges: interrupt it mid-flight (click twice), reduced motion (--reduced), dark mode (--dark), phone width (--w 390 --h 844), slow data (content arrives late).

Numbers

What Duration Easing
Press / hover feedback 80–120 ms ease-out
Small element enter (tooltip, menu, toast) 150–220 ms ease-out cubic-bezier(.2,.8,.2,1)
Exit (anything) 60–75% of its enter ease-in cubic-bezier(.4,0,1,1) or plain fade
Panel / sheet / dialog 240–340 ms strong ease-out cubic-bezier(.16,1,.3,1) or spring
Page / route / large shared-element 300–450 ms spring or cubic-bezier(.65,0,.35,1) for on-screen A→B
Stagger between list items 20–40 ms each, cap total at ~200 ms same as the item
  • Ease-out for things arriving, ease-in for things leaving, ease-in-out only for things that move from one on-screen spot to another. Linear only for spinners, progress and loops.
  • Springs (motion/framer-motion, SwiftUI): UI default stiffness 400–550, damping 32–40, mass 1 (≈ no visible overshoot). Playful/bouncy: damping 18–24. SwiftUI: .snappy, .smooth, or .spring(response: 0.35, dampingFraction: 0.85). Use springs whenever the motion can be interrupted or follows a gesture — they keep velocity; tweens restart.
  • Distance is small. Enter offsets 4–16 px, scale from 0.96–0.98, never from 0. Big slides read as slow even when they're fast.
  • Bigger/farther = slightly longer; never longer than ~450 ms for anything the user waits on.

Choreography

  • One hero per transition. The thing the user acted on leads; everything else follows 20–60 ms later or just fades.
  • Animate from the cause. A menu grows from its button (transform-origin at the trigger), a toast enters from where toasts live, a deleted row collapses in place.
  • Continuity beats decoration. If an element exists before and after, morph it (layout animation / layoutId / View Transitions view-transition-name / SwiftUI matchedGeometryEffect) instead of fading one out and another in.
  • Exits are quiet. Shorter, less travel, usually opacity + 2–4 px.
  • Don't animate what the user is reading or typing into. No motion on text that's updating while focused, no layout shift under the cursor.
  • Loading → content: hold skeletons/orbs ≥ 300 ms or don't show them at all (avoid a 50 ms flash); crossfade content in 150–200 ms; reserve the final size to avoid shift.

Implementation rules

  • Animate only transform and opacity (and filter/clip-path sparingly). Never width/height/top/left/margin — use layout animations (FLIP) for size and position changes.
  • Exit animations need the element to stay mounted: AnimatePresence, a data-state attribute + animationend, or View Transitions. A conditional && alone pops.
  • Every animation must be interruptible: re-triggering mid-flight continues from the current value, never snaps to the start. Test it with two quick actions in strip.mjs.
  • Reduced motion: keep opacity/color changes, drop travel and scale, cut springs to instant or 100 ms fades. @media (prefers-reduced-motion: reduce), useReducedMotion(), SwiftUI @Environment(\.accessibilityReduceMotion). Never remove the state change itself.
  • will-change only during the animation; no infinite animations on things off-screen.
  • Keep the numbers in tokens (--ease-out, --dur-panel, a springs.ts) so the app has one motion language.

scripts/strip.mjs: see the motion

node ${SKILL_DIR}/scripts/strip.mjs \
  --url http://localhost:5173/settings --act "click:[data-testid=open-panel]" \
  --ms 500 --step 33 --clip "[role=dialog]" --out strip-panel
# then open strip-panel/sheet.png (read the image) — every frame is stamped with its ms
  • Freezes time (Playwright clock fakes rAF/Date/performance, so JS springs step deterministically) and seeks every CSS/WAAPI animation to the same elapsed time, so the strip is identical on every run. Uses the installed Chrome/Chromium (macOS app path, google-chrome, chromium, chromium-browser; CHROME=/path to override). No browser is downloaded. On first run it installs playwright-core@1 next to the script (needs npm); if that's not possible it prints the one-line install command. --url also takes a local file path (--url ./demo.html).
  • --act is ;-separated: click:, hover:, focus:, press:Key, type:sel=text, wait:ms, eval:js. These run before capture starts. Prefix one with @<ms>: to fire it during capture instead. That is the interrupt test: --act "click:#open;@100:press:Escape;@170:click:#open" shows whether the close reverses from mid-flight and the reopen continues without a snap.
  • Flags: --reduced, --dark, --w/--h (phone: 390×844), --clip <selector>.
  • Known limit: animations run entirely on the compositor by a native app (Electron native views, iOS) aren't captured. For SwiftUI use Xcode previews / simulator screen recording.
  • Compare against a reference: capture the reference the same way (same --step) and put both sheets side by side. Matching a known-good strip beats arguing about feel.

References for iOS / SwiftUI

If an iOS motion-reference MCP or library is connected (real interaction breakdowns with SwiftUI code), use it to compare against known-good examples; it isn't required. The principles above apply the same way in SwiftUI.

04 同仓库更多 Skills

Allternit
Allternit/allternit-platform

Jev类型化判断推理

jev

针对 Allternit 的本地 System One 服务器发起类型化的 System One 判断(noul / choice / score),而不是通过提示让聊天模型“返回 JSON”。用于分类、路由、评分或筛选场景:当代码需要一个可据以分支的概率值,或当用户运行 /jev 时使用。官方 TypeSafe Jev 是可选且显式的远程通道。

AI 工程师大模型应用开发
★ 1
Allternit
Allternit/allternit-platform

jev-route

Route with local System One answers — map Choice + confidence to act / confirm / human lanes, or pick a model tier by Choice label. Also documents the separate `route-model` helper for OpenRouter's typesafe/jev-router (a chat-model router, NOT System One). Use for confidence routing, model-tier routing, or when the user runs /jev-route.

★ 1
Allternit
Allternit/allternit-platform

jev-guardrail

Screen text or agent tool calls with a battery of local System One Noul hazards plus a Score, with policy in code — and the Claude Code PreToolUse guard (hooks/pretooluse-guard) that puts deterministic hard rules first and lets Jev only raise friction. Use for injection/secret/destructive-action screening or when the user runs /jev-guardrail.

★ 1
Allternit
Allternit/allternit-platform

jev-fanout

Ask every independent System One question over the same state in ONE POST /v1/systemone to the local server (speculative fan-out). Use for parallel judgments, compound commands, one-call turn assessment, or when the user runs /jev-fanout. Do not fire one HTTP call per question.

★ 1
Allternit
Allternit/allternit-platform

memory-drive

Read and write the user's Allternit Memory Drive, a git repo of markdown memories in the open Agent Memory Repo format. Use at the start of a session to load what the user's agents remember (MEMORY.md), when the user says "remember this", when you learn a durable fact about the user or their work, and before answering questions that depend on past sessions.

★ 1
Allternit
Allternit/allternit-platform

外部 CLI 代理编排

agent-orchestrator

通过 Allternit Factory(gizzi agents / orchestration / workspace / workflows)编排外部 CLI 代理(kimi、codex、agy、claude、grok、gizzi)。当用户要求将实现工作委派、转移或分派给其他 CLI 代理/终端会话,或在本会话之外运行工作以节省 token 时使用。属于 Allternit Agents / Bot Agents 的一部分——并非独立产品。

软件开发工程师编码任务委派
★ 1