全部效果加载与反馈

成功勾选动画

Animated Checkmark

操作成功后,对勾沿笔画逐渐显现,用来确认任务已经完成。

播放成功反馈

适用场景

配合状态文案,确认保存、提交或上传已经完成。 收到成功结果后再画勾,动画结束后保留明确的文字,让用户随时核对结果。

应用示例

志愿者报名周六值班,系统确认报名后,在「已预约周六班次」旁逐笔画出对勾。对勾画完后,文字仍留在页面上供用户核对。

AI 提示词

给【目标操作】添加 Animated Checkmark。实际操作返回成功后,只播放一次短暂的对勾笔画动画。配上可读的成功文案,对辅助技术隐藏装饰性对勾。减少动态效果模式下直接显示完整对勾。

示例代码

保存为 HTML 文件后,用浏览器打开即可运行。代码与页面里的演示一致。

查看 HTML
<!doctype html>
<html lang="zh">
<head>
  <meta charset="utf-8">
  <meta name="viewport" content="width=device-width, initial-scale=1">
  <title>成功勾选动画</title>
  <style>
    :root {
      color-scheme: dark;
      --demo-bg: #171629;
      --demo-ink: #f8f5ff;
      --demo-accent: #b9a6ff;
      --demo-muted: #bfbbd3;
      font-family: system-ui, sans-serif;
      color: var(--demo-ink);
      background: var(--demo-bg);
    }

    *, *::before, *::after { box-sizing: border-box; }
    body { margin: 0; min-width: 0; }
    button, input { font: inherit; }

    .demo {
      display: grid;
      place-items: center;
      align-content: center;
      min-height: 100vh;
      padding: 14px;
      overflow: hidden;
      background: radial-gradient(ellipse at 50% 24%, #28233f, var(--demo-bg) 78%);
    }

    .demo-button {
      border: 1px solid #ffffff3d;
      border-radius: 7px;
      background: #ffffff12;
      color: var(--demo-ink);
      padding: 6px 11px;
      font-size: 12px;
      cursor: pointer;
    }

    :focus-visible {
      outline: 2px solid var(--demo-accent);
      outline-offset: 3px;
    }

    .check-example { display: grid; justify-items: center; gap: 12px; }
    .check-result {
      display: flex;
      align-items: center;
      gap: 11px;
      padding: 11px 16px 11px 11px;
      border: 1px solid #35605a;
      border-radius: 16px;
      background: #1b3534;
      color: #d7f9e9;
      font-size: 13px;
      font-weight: 650;
    }
    .check-badge {
      display: grid;
      place-items: center;
      width: 39px;
      height: 39px;
      border-radius: 50%;
      background: #a1f1ce;
      color: #164737;
    }
    .checkmark { position: relative; width: 10px; height: 18px; transform: translateY(-2px) rotate(45deg); }
    .checkmark::before, .checkmark::after {
      position: absolute;
      right: 0;
      bottom: 0;
      background: currentColor;
      border-radius: 2px;
      content: '';
    }
    .checkmark::before { width: 100%; height: 3px; transform-origin: left; }
    .checkmark::after { width: 3px; height: 100%; transform-origin: bottom; }
    [data-drawing] .checkmark::before { animation: draw-short 160ms ease-out both; }
    [data-drawing] .checkmark::after { animation: draw-long 230ms 150ms ease-out both; }
    @keyframes draw-short { from { transform: scaleX(0); } to { transform: scaleX(1); } }
    @keyframes draw-long { from { transform: scaleY(0); } to { transform: scaleY(1); } }
    @media (prefers-reduced-motion: reduce) {
      [data-drawing] .checkmark::before, [data-drawing] .checkmark::after { animation: none; }
      [data-replay] { display: none; }
    }
  </style>
</head>
<body>
  <main class="demo">
    <div class="check-example">
      <div class="check-result" role="status">
        <span class="check-badge" aria-hidden="true"><span class="checkmark"></span></span>
        <span>保存成功</span>
      </div>
      <button class="demo-button" type="button" data-replay>重播演示</button>
    </div>
  </main>
  <script>
    const result = document.querySelector('.check-result');
    document.querySelector('[data-replay]').addEventListener('click', () => {
      result.removeAttribute('data-drawing');
      // Commit the reset before replaying the two strokes.
      void result.offsetWidth;
      result.setAttribute('data-drawing', '');
    });
  </script>
</body>
</html>

UI Skills 原创示例