apple-design
它能做什么
这个技能分享 Apple 设计演讲中的原则,并将其应用到网页界面中。适合希望拖拽、滑动和弹出面板等交互感觉真实、灵敏的开发者和设计师。
适用场景
- ✓当你构建或审查由手势驱动的界面,例如拖拽、滑动或面板时。
- ✓当你希望弹簧动画可以被中断并重新引导时。
- ✓当你需要支持减少动态效果,或优化排版和材质时。
技能链接
https://github.com/spree/spree/blob/main/.agents/skills/apple-design/SKILL.md复制后粘贴给你的 AI(Claude、ChatGPT 或 Cursor),让它按照说明操作。
使用方法
最简单的方法:复制下面的消息,粘贴给你的 AI。它会读取这个技能并按说明操作。
可直接粘贴的消息
适用于 Claude Code、Codex 或 Cursor:在项目文件夹中运行,即可安装该技能。
下载 SKILL.md,放进智能体的技能文件夹。
可以这样问 AI
“请让这个底部面板跟随我的手指移动,带有惯性,并在我松开时感觉自然。”
每周 5 个新技能,1 分钟读完。
工作原理
智能体会应用一组原则:动效从屏幕上的当前数值开始,保留用户的速度,并且可以在任何时刻被抓住并反向。它使用弹簧和网页输入事件来实现这一效果。
技术内容(原始 SKILL.md)
作者在 GitHub 上的英文原文。
Apple Design
How Apple builds interfaces that stop feeling like a computer and start feeling like an extension of you. This knowledge comes from Apple's WWDC design talks — chiefly Designing Fluid Interfaces (WWDC 2018) — distilled and translated into the web platform (CSS, Pointer Events, requestAnimationFrame, spring libraries like Motion/Framer Motion).
The through-line: an interface feels alive when motion starts from the current on-screen value, inherits the user's velocity, projects momentum forward, and can be grabbed and reversed at any instant. Springs are the tool that makes all of this natural, because they are inherently interruptible and velocity-aware.
The Core Idea
"When we align the interface to the way we think and move, something magical happens — it stops feeling like a computer and starts feeling like a seamless extension of us."
An interface is fluid when it behaves like the physical world: things respond instantly, move continuously, carry momentum, resist at boundaries, and can be redirected mid-motion. Everything below is a way to get closer to that.
Apple frames design as serving four human needs: safety/predictability, understanding, achievement, and joy. Every rule here serves one of them.
1. Response — kill latency
The moment lag appears, the feeling of directness "falls off a cliff." Response is the foundation everything else is built on.
- Respond on pointer-down, not on release. Highlight a button the instant it's pressed. Waiting for
click/touch-up to show feedback feels dead. - Be vigilant about every latency. Audit debounces, artificial timers, transition waits, and the ~300ms tap delay. Anything on the input path that isn't essential is a regression.
- Feedback must be continuous during the interaction, not just at the end. For a drag, slider, or drawer, update the UI 1:1 with the pointer the whole way through — never animate only when the gesture completes.
/* Feedback lives on the press, and it's instant */
.button:active {
transform: scale(0.97);
transition: transform 100ms ease-out;
}
2. Direct manipulation — 1:1 tracking
"Touch and content should move together."
When the user drags something, it must stay glued to the finger — and respect the offset from where they grabbed it. Snapping to the element's center on grab breaks the illusion immediately.
- Use Pointer Events with
setPointerCaptureso tracking continues even when the pointer leaves the element's bounds. - Track a short velocity/position history (last few
pointermoveevents), not just the current point — you'll need velocity at release.
el.addEventListener('pointerdown', (e) => {
el.setPointerCapture(e.pointerId);
const grabOffset = e.clientY - el.getBoundingClientRect().top; // respect where they grabbed
// ...track position + timestamp history for velocity
});
3. Interruptibility — the single most important principle
"The thought and the gesture happen in parallel."
Every animation must be interruptible and redirectable at any moment. A user must be able to grab a moving element mid-flight and reverse it without waiting for the animation to finish. A closing modal the user grabs again should follow the finger — not finish closing first, then reopen.
- Never lock out input during a transition.
- Always animate from the presentation (current) value, never the target value. On interrupt, read the element's live on-screen transform and start the new animation from there. Starting from the logical/target value causes a visible jump.
- Avoid CSS transitions and
@keyframesfor anything gesture-driven — they can't be smoothly grabbed and reversed mid-flight. Springs animate from the current value by default, which is exactly what interruption needs. - When a gesture reverses, blend velocity — don't hard-cut it. Replacing one animation with another at a reversal creates a velocity discontinuity, a "brick wall." Spring libraries that carry velocity through a re-target avoid it. (This is what iOS's additive animations do natively; on the web, choose a spring library that re-targets from the current velocity.)
- Decompose 2D motion into independent X and Y springs. A single spring on a 2D distance desyncs when X and Y have different velocities.
4. Behavior over animation — use springs
"Think of animation as a conversation between you and the object, not something prescribed by the interfac
常见问题
这只适用于 Apple 设备吗?
不是。它把 Apple 的设计原则转换为 CSS、Pointer Events 和弹簧库等网页工具。
可中断是什么意思?
动效可以在中途被抓住并反向,而不必等它完成。
它涵盖减少动态效果吗?
涵盖。该技能包含减少动态效果设置的指导。
详情
作者的原始描述
Apple's approach to interface design and fluid, physical motion, translated for the web. Use when building or reviewing gesture-driven UI, spring animations, drag/swipe/sheet interactions, momentum and interruptible transitions, translucent materials and depth, typography (optical sizing, tracking, leading), reduced-motion, or the design foundations (feedback, spatial consistency, restraint) behind Apple-style interfaces.
repo: spree/spree
热度
- GitHub 星标
- 16k
- 排名
- #10874
- 许可证
- BSD-3-Clause
- 更新时间
- 2026/11/2
评论
- …
同一仓库的更多技能
animate
16k从零开始构建动画,先判断是否应该产生动效,再在编写代码之前确定其目的、时长和曲线。
animation-vocabulary
16k把对某个动画或动效的模糊描述,转换为其准确的技术名称,让你知道该问什么。
find-animation-opportunities
16k在界面中搜索最适合添加动效的地方,并排除其余部分。给出一份简短的精确动画建议清单,且不改动代码。
improve-animations
16k审计代码库中的动画,并编写有优先级的计划,供另一个智能体执行。只提供计划,不改动源代码。