Community图像github.com

Adamparishspok/skills

为界面提供统一节奏的小词汇表微交互:CSS和动画的持续时间层级(点击/弹出/悬停/卡片/布局)、交换过渡、高亮行渐入、尾部箭头、微移、无平移的卡片抬升、滚动边缘淡入淡出,以及复制和切换按钮的图标/标签交换。

skills 是什么?

此技能通过定义一套统一的动画持续时间和微交互模式,解决了界面动画不一致和感觉“平淡”的问题。其核心思想有两部分:一是将分散的动画持续时间映射到一个固定的层级量表(点击/弹出/悬停/卡片/布局),确保产品全局节奏统一;二是通过一系列几何级悬停微交互(如生长的高亮、移动的箭头、倾斜的微移等)来替代单纯的变色效果,从而赋予界面更细腻的质感。技能提供了 CSS(Tailwind v4 @theme 和 @utility)、Motion/WAAPI(timing.ts)以及 React 组件(IconSwap、LabelSwap)的具体实现方案。它适用于 Cursor、Claude Code 和 Codex 等平台,能显著提升交互细节的打磨效率。

兼容平台~Claude Code~Codex CLI✓Cursor
npx skills add https://github.com/Adamparishspok/skills/tree/HEAD/skills/motion-and-hover-polish

Installed? Explore more 图像 skills: steipete/songsee, affaan-m/frontend-design, mattpocock/improve-codebase-architecture · View all 6 →

在你喜欢的 AI 中提问

打开一个已预加载此 Agent Skill 的新对话。

文档

动画层级与悬停配方

经过 17 个原型应用验证的两个核心理念:

  1. 持续时间是一个尺度,而不是每个组件各自拥有一个数字。 视觉会将统一的节奏识别为同一产品。较小的元素运动更快。
  2. 悬停会温和地移动几何。 一种渐入行内的高亮、一个“抵达”的箭头、一个向目标方向“倾斜”的V形符号、一个“滚动”到下一状态的标签。纯颜色变化的悬停读起来就像开关切换。

文件

  • references/recipes.css:Tailwind v4 的 @theme 令牌和 @utility 配方。
  • references/timing.ts:适用于 Motion 和 WAAPI 的相同层级。
  • references/swap.tsx:IconSwap 和 LabelSwap(React 组件)。

层级

层级毫秒适用场景
tap100图标交换、按下动作
pop150菜单、弹出框或工具提示的打开
hover200行或控件响应指针
card300卡片抬起、列表稳定、页面切换
layout500面板折叠、页面重排
  • 进入动画使用缓出曲线(cubic-bezier(0.22,1,0.36,1))。退出动画使用缓入曲线,并缩短一个层级。
  • 当两个元素交换位置时,离开的元素立即退出,进入的元素在 delay-handoff(50毫秒)延迟后开始。
  • 数值补间动画(计数器、进度条、图表线条)可以持续更长时间:视觉正在跟随数据。
  • 保留有意识的弹簧效果。

迁移:将所有临时定义的持续时间映射到最近的层级。

临时值层级
0.12tap
0.15–0.18pop
0.2–0.24hover
0.28–0.35card
0.4–0.5layout

几乎在所有地方,屏幕上的时间变化预计不超过 20 毫秒。

配方(每个元素一个)

  • hover-grow(导航行、链接行):
    • 高亮是一个 ::before 伪元素,起始时内嵌(3px 宽,6px 高)且透明,然后随着淡入扩展到整行。
    • 它也会在 :focus-visible、data-state=open 和 aria-current=page 状态下显示。
    • 方形或粗犷的设计(类似 Carbon)应保持扁平高亮。
  • trail(链接行、“浏览计划”):
    • 一个尾部字形,在父元素 .group 悬停或聚焦之前,以一半比例且透明状态呈现,从其前缘开始生长。
    • trail-out(从左下角生长)加上 arrow-up-right 标记离开当前应用的链接。
  • nudge / nudge-back(V形符号、“查看全部”、返回链接):向目标方向倾斜 2 像素。
  • lift(可点击的卡片):
    • 表面亮度提高一层,阴影深度增加一层,作用于 card 层级。
    • 永远不要平移:在光标下跳动的卡片会移动正在被瞄准的目标。
  • scroll-fade(滚动窗格):
    • 基于遮罩的边缘淡出,仅应用于仍可滚动的边缘。它由容器自身的滚动时间线驱动,无需背景颜色。
    • 不支持的浏览器则不显示淡出效果。
  • IconSwap(菜单变成关闭、复制变成对勾、太阳变成月亮):
    • 离开的图标缩小、倾斜 -22° 并以缓入曲线淡出。
    • 进入的图标在手柄延迟后跟随进入。
    • 两者始终保持挂载状态,以便中途能够干净地反转。
  • LabelSwap(“复制链接”变成“已复制”、“折叠”变成“展开”):
    • 两个标签位于同一个网格单元格中,因此不会有宽度跳跃。
    • 隐藏的标签通过 transition-discrete 变为 invisible,因此辅助技术只能听到当前显示的标签。

陷阱

  • 在自身有动画的元素上使用 scroll-fade(Radix 菜单、弹出框或选择内容)会替换该元素的退出动画。Radix 等待一个永不结束的退出,导致菜单保持打开。应将淡出放在内部的滚动子元素上。
  • scroll-fade 也会遮罩边框和阴影。 不要将其放在带边框的卡片上;应放在内部滚动器上。
  • Tailwind v4 中自定义 duration-* 工具类也必须设置 --tw-duration,否则同一元素上的 transition-[…] 工具类会根据排序顺序胜出。
  • 带有行高的命名类型步骤(--text-meta--line-height)在替换继承了父元素行高的任意大小时,会导致每个转换后的行偏移一个像素。为中间步骤指定自身无行高。
  • 将悬停效果限制在 @media (hover: hover) 之后。 在 :focus-visible 上显示相同状态,并尊重 prefers-reduced-motion(Motion 使用:<MotionConfig reducedMotion="user">)。

Individual skills in this repo

This repo contains 4 individual skills — each has its own dedicated page.

Adamparishspok/skills

Make a website, web app or online store ready for AI agents. Scan it with Cloudflare's Agent Readiness checks, decide which checks apply to this kind of site, ship the discovery files and headers in priority order, and add the AI-first basics the scanner does not score (server-rendered content, JSON-LD, llms.txt). Covers robots.txt AI rules, Content Signals, sitemap, Markdown for Agents (Accept text/markdown), Link headers, API catalog, OAuth discovery, auth.md, MCP server card, A2A agent card, agent skills index, WebMCP, and commerce protocols (ACP, UCP, AP2, MPP, x402). Use when making a site AI-ready, agent-ready or AI-first, or fixing an isitagentready.com or Cloudflare Agent Readiness report. Triggers on: AI ready, agent ready, AI-first, agent readiness, isitagentready, AI Crawl Control, Markdown for Agents, text/markdown, llms.txt, GPTBot, ClaudeBot, AI crawlers, Content-Signal, ai-train, api-catalog, .well-known, oauth-protected-resource, auth.md, MCP server card, agent card, agent skills, WebMCP, a...

Adamparishspok/skills

Install a complete, lean favicon set on any website or web app — the five files modern browsers, iOS and Android actually use, one block of head markup added once in the root layout, and a check that every file resolves. Covers finding the public folder per framework, generating the set from one SVG (or from a RealFaviconGenerator package), dark-mode SVG icons, maskable manifest icons, cache busting and verification. Use when adding, replacing or auditing a favicon, app icon, apple-touch-icon or web manifest. Triggers on: favicon, favicon.ico, favicon.svg, apple-touch-icon, site.webmanifest, manifest.json, app icon, PWA icon, maskable icon, tab icon, RealFaviconGenerator.

Adamparishspok/skills

Consolidate several apps or prototypes onto one shared component library without flattening their looks. Covers finding duplicated local components (buttons, selects, fields, modals, pagers, toasts), making shared components token-sized so each suite or app sets its own measurements, mapping variant names, deciding what stays app-specific, and the tailwind-merge traps that silently break custom tokens. Use when several apps each grew their own Btn/Select/Modal, when a design system's components "don't fit" a second product, or when retheming a family of apps. Triggers on: shared component library, design system consolidation, duplicate components, retheme, suite of apps, shadcn retokened, token-driven components, cn tailwind-merge custom tokens, variant mapping.

Adamparishspok/skills

Build or migrate a UI's neutral palette (grounds, surfaces, lines, ink/text) as an OKLCH formula driven by a few inputs instead of dozens of hand-picked hex values, with light and dark themes, per-step ladder overrides, a fit script that reproduces existing colours, and a browser contrast audit. Use when creating a theme, adding dark mode, retinting a product, auditing text contrast, or consolidating several apps' palettes. Triggers on: palette, neutrals, grey ramp, dark mode, theme tokens, oklch, retint, hue, contrast audit, design tokens, Tailwind @theme colours.

相关技能