Vibe Design Tips

依情境選擇緩動曲線

011 Easing Curves

依情境選擇緩動曲線

動態

七種常用的動畫速度曲線,從 Linear 到 Spring,分別適合什麼樣的動作。

動畫的節奏用速度曲線描述:曲線越陡,速度變化越劇烈,看起來就越快。選單彈出、對話框關閉、指示條滑動如果都用預設的 ease,使用者分不清元素是在出現、消失還是換位置。常用的曲線有以下幾種:

  1. Linear:用於進度條、載入這類看起來只是「在跑」的東西。等速運動,起止都很生硬,linear。
  2. Ease-out 與 Strong ease-out:浮層和模態元素的進場,例如 Toast、選單、對話框、抽屜,用先快後慢的 Ease-out,cubic-bezier(0, 0, .58, 1)。點擊後馬上就定位的小元素,例如圖示、文字、選中的膠囊,用起步更快、收尾更長的 Strong ease-out,cubic-bezier(.22, 1, .36, 1),回應最直接。
  3. Ease-in:用於元素離場,例如對話框關閉、Toast 消失。先慢後快,乾脆地離開,cubic-bezier(.42, 0, 1, 1)。不要用在進場上,起步慢,看起來像介面反應遲鈍。
  4. Ease-in-out:用於在介面內換位置的元素,例如分頁標籤下滑動的指示條、輪播翻頁、目錄平滑捲動。兩端慢、中間最快,cubic-bezier(.42, 0, .58, 1)。
  5. Overshoot:用於小而俏皮的確認,例如勾選、按讚、徽章彈出。衝過終點約 10% 再退回,cubic-bezier(.34, 1.56, .64, 1)。不要用在大面板上,否則整塊介面都會晃動。
  6. Spring:用於放開後的歸位,例如抽屜回彈、下拉重新整理、拖曳排序後的定位。到位後輕晃一兩下再停穩,比 Overshoot 更像真實物體;使用者放開時元素已經帶有速度,彈簧能接著這個速度運動。

另外,把這些曲線定義為動態 token,依角色使用,整個產品的節奏就能保持一致。

附帶的提示詞會先列出專案中所有的轉場和動畫,標出仍用預設 ease 或進場用了 ease-in 的地方,以及每處要換成的曲線;再加上動態 token,逐一調整曲線和時長。

Prompt複製後傳給 Claude Code、Cursor 等 Agent 即可
Give the motion in my product the right easing curves, so things arrive, leave and move the way they should feel. Work inside my existing code and design system: keep what each animation does, how far it goes and what triggers it. Change how it moves over time, and its duration where that is off.

0. Start from what exists
- Find every transition and animation: CSS transitions and keyframes, animation libraries (Framer Motion, GSAP, the Web Animations API) and hand-written requestAnimationFrame loops. List each with its component, its trigger, its duration and its curve.
- Flag the ones left on the CSS default `ease`, `linear` on something that moves, and `ease-in` on something that appears.

1. The curves as tokens
Define them once, next to the other motion tokens, and use only these:
- --ease-out: cubic-bezier(0, 0, .58, 1). Anything that enters: toasts, menus, popovers, dialogs, drawers.
- --ease-out-strong: cubic-bezier(.22, 1, .36, 1). Small parts settling in right after a click: an icon, a label, a selected pill. It feels the most responsive.
- --ease-in: cubic-bezier(.42, 0, 1, 1). Anything that leaves, and only that: a toast timing out, a dialog or drawer closing, a menu collapsing, a list item swiped away. It starts slow and leaves at full speed, so on an entrance it feels late and then stops with a bump.
- --ease-in-out: cubic-bezier(.42, 0, .58, 1). Something that stays on screen and only changes place or size: the indicator under tabs or a segmented control, a carousel turning a page, items making room during a reorder, a sidebar resizing, smooth-scrolling to an anchor. Not for coming in: its slow start reads as lag.
- --ease-overshoot: cubic-bezier(.34, 1.56, .64, 1). Runs about 10% past its place and comes back. Small, playful confirmations: a checkbox tick, a like, a badge count popping in, a switch knob settling. Never on a dialog, a drawer or anything larger than about 64px, and not on actions people repeat all day.
- --ease-spring: linear(0, .32, .78, 1.04, 1.09, 1.06, 1.02, 1, .99, .99, 1). Things let go after a drag or a swipe, so they settle like an object: a bottom sheet snapping open or back, a card returning after a half swipe, pull-to-refresh springing back, a reordered item dropping into place. Prefer the animation library's own spring fed with the release velocity; use this token only where there is none, and fall back to --ease-out-strong where linear() is not supported.
- linear: only for things that run rather than move: spinners, progress bars, marquees.
- The CSS default `ease` is not a choice. Replace it wherever a curve was left unset.

2. Durations
- Small UI (toasts, tooltips, menus, checks): 150-250ms in, 120-200ms out. Exits are shorter than entrances.
- Medium (dialogs, popovers with content, drawers): 250-350ms.
- Large or full-screen (sheets, page transitions): 350-500ms. Longer feels slow.
- Springs and overshoots: about 1.5x the plain duration, since the settle takes time.
- Keep the durations as tokens beside the curves (--duration-sm, -md, -lg).

3. Apply them by role
- Entrances: ease-out, coming from where the thing belongs (a toast from the top edge, a menu from its trigger), over a short distance (8-24px), growing from 96% and fading in a little sooner than it moves. A light blur (about 8px) that clears as it lands is a nice touch on toasts.
- Exits: ease-in, the same path reversed, and shorter.
- Moves on screen: ease-in-out.
- Parts inside something that has just appeared (its icon, its text, a count) may follow 100-200ms later on the strong ease-out, so it lands in steps rather than all at once.
- Gestures: while the pointer or finger moves, follow it 1:1 with no easing. On release, finish on the spring, from the release velocity if the library allows.
- Hover and press: 100-150ms ease-out. Never animate layout on hover.
- Animate transform and opacity (filter sparingly), not top, left, width or height, which lay out and repaint every frame.

4. Keep it consistent and accessible
- One curve per role across the product. Don't tune each component by hand.
- Respect prefers-reduced-motion: keep the opacity changes, drop movement and scale, and turn springs and overshoots into a plain 150ms fade.
- Never make a user wait on an animation: nothing blocks input, and a new action interrupts the old animation from where it is.

5. Deliver
- First list every animation you found, its current curve and duration, and the role and curve you will give it.
- Then add the tokens, switch each animation over, and list every file you touched.
- Don't change what animates, how far it goes or what triggers it. If an animation has no clear role, ask me first.