Notifications Toasts

dylantarre/animation-principles/skills/07-by-ui-element/notifications-toasts

作者 dylantarre83597134ba8f无许可证99 个星标收录于 2026年10月8日更新于 2026年10月8日仓库9个月前更新

Use when animating notifications, toasts, alerts, snackbars, or system messages to grab attention appropriately

仅含说明Design & Creative
AI 生成的概览

将迪士尼十二项动画原则应用于通知与提示条动画,并附 CSS 示例。

功能
该技能为通知、提示条、警报、snackbar 和系统消息的动画提供指导,使其既能吸引注意又不打扰用户。它把迪士尼十二项动画原则逐条对应到通知行为,涵盖进入、注意和退出状态。它还提供提示条进入与退出关键帧及进度条的 CSS 片段,并给出建议的时长数值和关键属性。
适用场景
适用于设计或实现带动画的通知、提示条、警报、snackbar 或系统消息。适合需要让进入、消失和吸引注意的动效显得精致而非突兀的场景。
运行要求
无需脚本或特殊工具,该技能仅包含说明和 CSS 示例。应用其中的 CSS 需要 Web 前端环境。

Notification & Toast Animation Principles

Apply Disney's 12 principles to notifications for attention-grabbing yet non-disruptive alerts.

Principles Applied to Notifications

1. Squash & Stretch

Toast can compress slightly on entrance impact, then stretch back. Creates a "landing" feel as if it arrived from off-screen.

2. Anticipation

Before auto-dismiss, toast can contract slightly (95% scale) for 100ms. Signals imminent departure to user.

3. Staging

Notifications should appear in consistent locations. Use color and icons to stage importance: info, success, warning, error.

4. Straight Ahead & Pose to Pose

Define states: entering, visible, exiting, stacked. Clear keyframes for entrance, attention (if needed), and exit.

5. Follow Through & Overlapping Action

Icon animates after container arrives (checkmark draws, bell wobbles). Progress bar for auto-dismiss follows toast entrance.

6. Ease In & Ease Out

Enter: ease-out (fast in, slow settle). Exit: ease-in (slow start, fast out). cubic-bezier(0.68, -0.55, 0.27, 1.55) for bounce.

7. Arcs

Toasts sliding from corners can follow slight arc. Bell icons should swing in arc, not rotate rigidly.

8. Secondary Action

While toast slides in (primary), shadow appears (secondary), icon animates (tertiary), progress bar starts (quaternary).

9. Timing

  • Toast enter: 200-300ms
  • Toast exit: 150-250ms
  • Auto-dismiss delay: 3000-5000ms
  • Attention pulse: 1000ms loop
  • Success checkmark draw: 300ms
  • Stack reorder: 200ms

10. Exaggeration

Error notifications can shake or pulse red. Critical alerts can be larger, bolder animations. Match urgency to importance.

11. Solid Drawing

Maintain consistent toast sizing. Icons should be crisp. Progress bars should be smooth (use transforms, not width).

12. Appeal

Smooth notifications feel polished. Jarring popups annoy users. A well-animated toast conveys professionalism.

CSS Implementation

css
.toast {  animation: toastEnter 300ms cubic-bezier(0.68, -0.55, 0.27, 1.55);}
.toast.exiting {  animation: toastExit 200ms ease-in forwards;}
@keyframes toastEnter {  from {    opacity: 0;    transform: translateY(-100%) scale(0.9);  }  to {    opacity: 1;    transform: translateY(0) scale(1);  }}
@keyframes toastExit {  to {    opacity: 0;    transform: translateX(100%);  }}
.toast-progress {  transform-origin: left;  animation: progress 4000ms linear forwards;}

Key Properties

  • transform: translate, scale
  • opacity: fade
  • animation: entrance/exit sequences
  • transform-origin: progress bars
  • box-shadow: depth

来源与署名

来源:dylantarre/animation-principles位于skills/07-by-ui-element/notifications-toasts提交8359713

许可证: 无许可证

内容归原作者所有。SourceWeft 从公开仓库中收录这些内容。

举报或申请下架