环形进度

一圈 SVG 弧线画出完成度,中心放百分比

全平台通用动效与背景内容区效果

实时预览(拖动参数,立刻看变化)

代码

<svg width="120" height="120" viewBox="0 0 76 76" style="transform:rotate(-90deg)">
  <circle cx="38" cy="38" r="31" fill="none" stroke="#E3E0D8" stroke-width="7"/>
  <circle id="ring" cx="38" cy="38" r="31" fill="none" stroke="#141414" stroke-width="7"
    stroke-linecap="round" stroke-dasharray="195" stroke-dashoffset="195"/>
</svg>
<script>
// 周长 = 2πr ≈ 195;目标 72% → dashoffset = 195 × (1 − 0.72)
document.getElementById('ring').animate(
  [{ strokeDashoffset: 195 }, { strokeDashoffset: 195 * (1 - .72) }],
  { duration: 1100, easing: 'cubic-bezier(.22,1,.36,1)', fill: 'forwards' });
</script>

代码片段以 MIT 释出,可自由复制改用。

这个效果是怎么实现的

它是怎么工作的(中文)

SVG 圆的周长是 2πr,用 stroke-dasharray 把整圈分成「一段实线 + 空缺」,调 dashoffset 就能控制画出多少。动画时让 offset 从满值动到目标值即可。圆角端点(stroke-linecap: round)会让弧线显得柔和,是细节分。

How it works (English)

An SVG circle's circumference is 2πr; stroke-dasharray splits it into dash + gap, and stroke-dashoffset controls how much is drawn. Animate the offset from full to target. Rounded line caps soften the arc ends — a small detail that reads as polish.

参考与来源 Sources

本条为「批次 1(重建)」成果(2026-11-10 用户决定:原 妞妞老师 素材不导出,改由公开材料重建):效果概念参考开源效果生态——Magic UI(MIT)、Uiverse(MIT)、Animista、Paper Shaders(Apache-2.0)、tsParticles(MIT)、CSS Loaders(MIT)等(见 /resources 对应条目,许可以各项目为准);本站的实现代码、参数体系与全部文案均为 Aglaia 原创,未复制上述项目的代码或文案,也与 妞妞老师 原始素材无关。

配套提示词

环形进度 · 提示词待复验 · →