Kinetic Progress
A progress bar or ring with an animated fill, a live percentage and an indeterminate mode for unknown waits.
- <kt-kinetic-progress>
- Feedback
- No framework
The code
Copy the Kinetic Progress
Fastest: press Copy on the card above for one complete file. To build it into your own
project, use the files below: the markup, the styles, this component’s script and the shared
effects script (effects.js) that every component uses.
<kt-kinetic-progress label="Uploading photos" value="68"></kt-kinetic-progress>
<kt-kinetic-progress label="Syncing workspace" indeterminate></kt-kinetic-progress>
<kt-kinetic-progress label="Storage used" variant="ring" value="42"></kt-kinetic-progress>
<kt-kinetic-progress label="Export complete" value="120" max="120"></kt-kinetic-progress>
kt-kinetic-progress {
display: block;
width: 100%;
max-width: 340px;
}
.kt-progress {
--_color: var(--kt-accent);
--_ink: var(--kt-accent-ink);
display: flex;
flex-direction: column;
gap: 8px;
font-family: var(--font-sans);
color: var(--kt-surface-ink);
}
.kt-progress-head {
display: flex;
align-items: baseline;
justify-content: space-between;
gap: 12px;
}
.kt-progress-label {
font-size: 13px;
font-weight: 600;
line-height: 1.3;
min-width: 0;
}
.kt-progress-label[hidden] { display: none; }
.kt-progress-pct,
.kt-progress-ring-pct {
font-family: var(--font-mono);
font-size: 11px;
font-weight: 700;
line-height: 1;
color: var(--kt-surface-muted);
font-variant-numeric: tabular-nums;
margin-left: auto;
}
.kt-progress-bar {
position: relative;
display: block;
}
.kt-progress-track {
position: relative;
display: block;
height: 10px;
overflow: hidden;
border-radius: var(--kt-radius-track);
border-style: solid;
border-width: var(--kt-border-w);
border-color: var(--kt-comp-border, var(--bw-border));
background: var(--bw-subtle);
box-sizing: content-box;
box-shadow: var(--kt-comp-shadow);
}
.kt-progress-fill {
position: absolute;
inset: 0;
display: block;
background: var(--_color);
border-radius: inherit;
transform-origin: left center;
transform: scaleX(0);
transition: transform 520ms cubic-bezier(0.22, 1, 0.36, 1);
}
[data-vfx="enterprise"] .kt-progress-fill { transition-duration: 320ms; }
[data-vfx="elastic"] .kt-progress-fill { transition-timing-function: cubic-bezier(0.34, 1.4, 0.64, 1); }
[data-vfx="glitch"] .kt-progress-fill { transition-timing-function: steps(8, end); }
[data-vfx="neon"] .kt-progress-fill { box-shadow: 0 0 12px 1px var(--_color); }
.kt-progress-ring,
.kt-progress-ring-pct { display: none; }
/* ring variant */
.kt-progress[data-variant="ring"] {
flex-direction: row;
align-items: center;
gap: 14px;
}
.kt-progress[data-variant="ring"] .kt-progress-head { order: 2; flex: 1; min-width: 0; }
.kt-progress[data-variant="ring"] .kt-progress-pct { display: none; }
.kt-progress[data-variant="ring"] .kt-progress-bar { order: 1; width: 72px; height: 72px; flex-shrink: 0; }
.kt-progress[data-variant="ring"] .kt-progress-track { display: none; }
.kt-progress[data-variant="ring"] .kt-progress-ring { display: block; width: 100%; height: 100%; }
.kt-progress[data-variant="ring"] .kt-progress-ring-pct {
display: grid;
place-items: center;
position: absolute;
inset: 0;
margin: 0;
font-size: 14px;
color: var(--kt-surface-ink);
}
.kt-progress-ring-track {
stroke: var(--bw-subtle);
stroke-width: 7;
}
.kt-progress-ring-arc {
stroke: var(--_color);
stroke-width: 7;
stroke-linecap: round;
transition: stroke-dashoffset 520ms cubic-bezier(0.22, 1, 0.36, 1);
}
[data-vfx="enterprise"] .kt-progress-ring-arc { transition-duration: 320ms; }
[data-vfx="neon"] .kt-progress-ring-arc { filter: drop-shadow(0 0 4px var(--_color)); }
/* indeterminate */
.kt-progress[data-indeterminate] .kt-progress-fill {
right: auto;
width: 40%;
transform: translateX(-100%);
transition: none;
animation: kt-progress-slide 1.3s cubic-bezier(0.45, 0, 0.35, 1) infinite;
}
[data-vfx="glitch"] .kt-progress[data-indeterminate] .kt-progress-fill { animation-timing-function: steps(10, end); }
[data-vfx="elastic"] .kt-progress[data-indeterminate] .kt-progress-fill { animation-timing-function: cubic-bezier(0.34, 1.4, 0.64, 1); }
.kt-progress[data-indeterminate] .kt-progress-ring-arc {
stroke-dashoffset: 72;
transition: none;
transform-origin: 32px 32px;
animation: kt-progress-spin 1.1s linear infinite;
}
.kt-progress[data-indeterminate][data-variant="ring"] .kt-progress-ring { overflow: visible; }
.kt-progress.is-complete .kt-progress-fill { animation: kt-progress-flash 500ms ease; }
.kt-progress.is-complete .kt-progress-ring { animation: kt-progress-pop 420ms var(--ease-overshoot); }
.kt-progress-live {
position: absolute;
width: 1px;
height: 1px;
margin: -1px;
overflow: hidden;
clip: rect(0 0 0 0);
white-space: nowrap;
}
.kt-progress-bar:focus-visible {
outline: 2px solid var(--kt-surface-ink);
outline-offset: 3px;
}
@keyframes kt-progress-slide {
0% { transform: translateX(-100%); }
100% { transform: translateX(250%); }
}
@keyframes kt-progress-spin {
to { transform: rotate(270deg); }
}
@keyframes kt-progress-flash {
0%, 100% { filter: brightness(1); }
35% { filter: brightness(1.35); }
}
@keyframes kt-progress-pop {
0% { transform: scale(1); }
40% { transform: scale(1.06); filter: brightness(1.2); }
100% { transform: scale(1); }
}
@media (prefers-reduced-motion: reduce) {
.kt-progress-fill,
.kt-progress-ring-arc { transition: none; }
.kt-progress[data-indeterminate] .kt-progress-fill {
animation: none;
transform: none;
width: 100%;
opacity: 0.45;
}
.kt-progress[data-indeterminate] .kt-progress-ring-arc { animation: none; }
}
class KtKineticProgress extends HTMLElement {
static get observedAttributes() {
return ["value", "max", "indeterminate", "label", "variant"];
}
constructor() {
super();
this._rendered = false;
this._uid = `kt-pg-${Math.random().toString(36).slice(2, 8)}`;
this._shown = 0;
this._raf = null;
this._lastDone = false;
}
connectedCallback() {
if (!this._rendered) {
this.render();
this._rendered = true;
}
this.syncAttributes(true);
}
disconnectedCallback() {
if (this._raf) cancelAnimationFrame(this._raf);
this._raf = null;
}
attributeChangedCallback() {
if (this._rendered) this.syncAttributes(false);
}
get max() {
const m = Number(this.getAttribute("max"));
return m > 0 ? m : 100;
}
get value() {
const v = Number(this.getAttribute("value"));
return Math.min(this.max, Math.max(0, Number.isFinite(v) ? v : 0));
}
set value(v) { this.setAttribute("value", String(v)); }
get indeterminate() { return this.hasAttribute("indeterminate") && this.getAttribute("indeterminate") !== "false"; }
get label() { return this.getAttribute("label") || ""; }
get variant() { return this.getAttribute("variant") === "ring" ? "ring" : "bar"; }
get percent() { return Math.round((this.value / this.max) * 100); }
render() {
this.innerHTML = "";
const R = 26;
const wrap = document.createElement("div");
wrap.className = "kt-progress";
wrap.innerHTML = `
<div class="kt-progress-head">
<span class="kt-progress-label" id="${this._uid}-l"></span>
<span class="kt-progress-pct" aria-hidden="true">0%</span>
</div>
<div class="kt-progress-bar" role="progressbar" aria-labelledby="${this._uid}-l" aria-valuemin="0">
<span class="kt-progress-track" aria-hidden="true">
<span class="kt-progress-fill"></span>
</span>
<svg class="kt-progress-ring" viewBox="0 0 64 64" aria-hidden="true" focusable="false">
<circle class="kt-progress-ring-track" cx="32" cy="32" r="${R}" fill="none"></circle>
<circle class="kt-progress-ring-arc" cx="32" cy="32" r="${R}" fill="none" pathLength="100"
stroke-dasharray="100" stroke-dashoffset="100" transform="rotate(-90 32 32)"></circle>
</svg>
<span class="kt-progress-ring-pct" aria-hidden="true">0%</span>
</div>
<span class="kt-progress-live" role="status" aria-live="polite"></span>
`;
this._wrap = wrap;
this._labelEl = wrap.querySelector(".kt-progress-label");
this._pctEl = wrap.querySelector(".kt-progress-pct");
this._bar = wrap.querySelector(".kt-progress-bar");
this._fill = wrap.querySelector(".kt-progress-fill");
this._arc = wrap.querySelector(".kt-progress-ring-arc");
this._ringPct = wrap.querySelector(".kt-progress-ring-pct");
this._live = wrap.querySelector(".kt-progress-live");
this.appendChild(wrap);
}
syncAttributes(first) {
if (!this._wrap) return;
const ind = this.indeterminate;
const done = !ind && this.value >= this.max;
const text = this.label;
this._wrap.setAttribute("data-variant", this.variant);
this._wrap.toggleAttribute("data-indeterminate", ind);
this._wrap.toggleAttribute("data-done", done);
this._labelEl.textContent = text;
this._labelEl.hidden = !text;
if (!text) this._bar.setAttribute("aria-label", ind ? "Loading" : "Progress");
else this._bar.removeAttribute("aria-label");
this._bar.setAttribute("aria-valuemax", String(this.max));
if (ind) {
this._bar.removeAttribute("aria-valuenow");
this._bar.setAttribute("aria-valuetext", "Loading");
this._pctEl.textContent = "";
this._ringPct.textContent = "";
} else {
this._bar.setAttribute("aria-valuenow", String(this.value));
this._bar.setAttribute("aria-valuetext", `${this.percent}%${done ? ", complete" : ""}`);
this.animateTo(this.percent, first);
}
if (!first && done && !this._lastDone) {
this._live.textContent = (text ? text + " " : "") + "complete";
this.celebrate();
} else if (!done) {
this._live.textContent = "";
}
this._lastDone = done;
}
animateTo(target, instant) {
if (this._raf) cancelAnimationFrame(this._raf);
const reduced = window.matchMedia && window.matchMedia("(prefers-reduced-motion: reduce)").matches;
const scale = target / 100;
this._fill.style.transform = `scaleX(${scale})`;
this._arc.style.strokeDashoffset = String(100 - target);
const from = this._shown;
const dur = reduced || instant ? 0 : SakugaFX.getMode() === "enterprise" ? 320 : 520;
if (!dur || from === target) {
this._shown = target;
this.paintPct(target);
return;
}
const t0 = performance.now();
const step = (now) => {
const p = Math.min(1, (now - t0) / dur);
const eased = 1 - Math.pow(1 - p, 3);
this._shown = from + (target - from) * eased;
this.paintPct(Math.round(this._shown));
if (p < 1) this._raf = requestAnimationFrame(step);
else {
this._shown = target;
this._raf = null;
}
};
this._raf = requestAnimationFrame(step);
}
paintPct(n) {
const t = n + "%";
this._pctEl.textContent = t;
this._ringPct.textContent = t;
}
celebrate() {
const mode = SakugaFX.getMode();
if (mode === "enterprise") return;
const color = readAccent(this._wrap);
const target = this.variant === "ring" ? this._bar : this._fill;
const rect = target.getBoundingClientRect();
const x = this.variant === "ring" ? rect.left + rect.width / 2 : rect.right;
const y = rect.top + rect.height / 2;
this._wrap.classList.remove("is-complete");
void this._wrap.offsetWidth;
this._wrap.classList.add("is-complete");
if (mode === "glitch") SakugaFX.emitPixels(x, y, color, 12);
else if (mode === "ink") SakugaFX.emitInkSplatter(x, y, color, 10);
else if (mode === "neon") {
SakugaFX.emitShockwave(x, y, color, 52);
SakugaFX.emitRays(x, y, color, 8, 40);
} else {
SakugaFX.emitShockwave(x, y, color, 44);
SakugaFX.emitBurst(x, y, color, { count: 10, speed: 180, shards: false });
}
}
}
customElements.define("kt-kinetic-progress", KtKineticProgress);
function contrastInk(hex) {
const clean = hex.replace("#", "");
if (clean.length !== 6) return "#ffffff";
const r = parseInt(clean.slice(0, 2), 16);
const g = parseInt(clean.slice(2, 4), 16);
const b = parseInt(clean.slice(4, 6), 16);
const lum = (0.299 * r + 0.587 * g + 0.114 * b) / 255;
return lum > 0.6 ? "#09090b" : "#ffffff";
}
function readAccent(el) {
const val = getComputedStyle(el).getPropertyValue("--kt-accent").trim();
return val || "#09090b";
}
class SakugaVFXEngine {
constructor(canvas) {
this.canvas = canvas;
this.ctx = canvas.getContext("2d");
this.items = [];
this.rafId = null;
this.lastTime = 0;
this.textEnabled = false;
this.textOverride = "";
this.vfxTextColor = "auto";
this.resize();
window.addEventListener("resize", () => this.resize());
}
attach(canvas) {
this.canvas = canvas;
this.ctx = canvas.getContext("2d");
this.items = [];
this.resize();
}
resize() {
const dpr = Math.min(window.devicePixelRatio || 1, 2);
this.canvas.width = Math.floor(window.innerWidth * dpr);
this.canvas.height = Math.floor(window.innerHeight * dpr);
this.ctx.setTransform(dpr, 0, 0, dpr, 0, 0);
}
getMode() {
if (window.matchMedia("(prefers-reduced-motion: reduce)").matches) return "enterprise";
return document.documentElement.getAttribute("data-vfx") || "enterprise";
}
wake() {
if (this.rafId !== null) return;
this.lastTime = performance.now();
const tick = (now) => {
const dt = Math.min((now - this.lastTime) / 1000, 0.05);
this.lastTime = now;
this.render(dt);
if (this.items.length > 0) {
this.rafId = requestAnimationFrame(tick);
} else {
this.rafId = null;
this.ctx.clearRect(0, 0, window.innerWidth, window.innerHeight);
}
};
this.rafId = requestAnimationFrame(tick);
}
emitBurst(x, y, color, { count = 14, speed = 240, spread = Math.PI * 2, baseAngle = 0, shards = true } = {}) {
if (this.getMode() === "enterprise") return;
for (let i = 0; i < count; i++) {
const angle = baseAngle + (Math.random() - 0.5) * spread;
const vel = speed * (0.45 + Math.random() * 0.75);
this.items.push({
kind: shards && i % 3 === 0 ? "shard" : "spark",
x, y,
vx: Math.cos(angle) * vel,
vy: Math.sin(angle) * vel - (spread > 4 ? 35 : 0),
gravity: 400,
drag: 0.94,
size: 3 + Math.random() * 4,
rot: Math.random() * Math.PI * 2,
vrot: (Math.random() - 0.5) * 14,
life: 0,
maxLife: 0.32 + Math.random() * 0.22,
color
});
}
this.wake();
}
emitShockwave(x, y, color, maxRadius = 64) {
if (this.getMode() === "enterprise") return;
this.items.push({ kind: "ring", x, y, radius: 8, maxRadius, life: 0, maxLife: 0.32, color });
this.wake();
}
emitSlash(x, y, color, angle = -0.3) {
if (this.getMode() === "enterprise") return;
this.items.push({ kind: "slash", x, y, angle, length: 96, life: 0, maxLife: 0.2, color });
this.wake();
}
emitSmoke(x, y, color, dirX = 0) {
if (this.getMode() === "enterprise") return;
for (let i = 0; i < 4; i++) {
this.items.push({
kind: "smoke",
x: x + (Math.random() - 0.5) * 8,
y: y + (Math.random() - 0.5) * 8,
vx: dirX * (50 + Math.random() * 70) + (Math.random() - 0.5) * 35,
vy: -20 - Math.random() * 50,
size: 5 + Math.random() * 5,
life: 0,
maxLife: 0.34 + Math.random() * 0.16,
color
});
}
this.wake();
}
emitPixels(x, y, color, count = 14) {
if (this.getMode() !== "glitch") return;
for (let i = 0; i < count; i++) {
const angle = Math.floor(Math.random() * 8) * (Math.PI / 4);
const vel = 120 + Math.random() * 200;
this.items.push({
kind: "pixel",
x: x + (Math.random() - 0.5) * 18,
y: y + (Math.random() - 0.5) * 12,
vx: Math.cos(angle) * vel,
vy: Math.sin(angle) * vel,
size: 4 + Math.floor(Math.random() * 5),
life: 0,
maxLife: 0.24 + Math.random() * 0.14,
color
});
}
this.wake();
}
emitScanline(x, y, color, width = 120) {
if (this.getMode() !== "glitch") return;
for (let i = -1; i <= 1; i += 2) {
this.items.push({
kind: "scanline",
x,
y: y + i * (5 + Math.random() * 6),
width,
life: 0,
maxLife: 0.18,
color
});
}
this.wake();
}
emitRays(x, y, color, count = 10, maxRadius = 72) {
if (this.getMode() !== "neon") return;
for (let i = 0; i < count; i++) {
const angle = (Math.PI * 2 * i) / count + (Math.random() - 0.5) * 0.18;
this.items.push({
kind: "ray",
x,
y,
angle,
maxRadius: maxRadius * (0.75 + Math.random() * 0.45),
life: 0,
maxLife: 0.34,
color
});
}
this.wake();
}
emitInkSplatter(x, y, color, count = 14) {
if (this.getMode() !== "ink") return;
for (let i = 0; i < count; i++) {
const angle = Math.random() * Math.PI * 2;
const vel = 110 + Math.random() * 230;
this.items.push({
kind: "inkblot",
x,
y,
vx: Math.cos(angle) * vel,
vy: Math.sin(angle) * vel - 30,
gravity: 480,
drag: 0.91,
size: 2.5 + Math.random() * 5.5,
life: 0,
maxLife: 0.38 + Math.random() * 0.22,
color
});
}
// Brush arc sweep
this.items.push({
kind: "brusharc",
x,
y,
radius: 24 + Math.random() * 14,
startAngle: -Math.PI * 0.75,
endAngle: Math.PI * 0.35,
life: 0,
maxLife: 0.26,
color
});
this.wake();
}
emitMangaSFX(x, y, text, color) {
const mode = this.getMode();
const finalText = this.textOverride || text;
if (mode === "enterprise" || !this.textEnabled || !finalText || finalText === "none") return;
const fillColor = this.vfxTextColor !== "auto" ? this.vfxTextColor : color;
const outline = this.vfxTextColor !== "auto"
? contrastInk(this.vfxTextColor)
: (document.documentElement.getAttribute("data-bw") === "dark" ? "#09090b" : "#ffffff");
this.items.push({
kind: "sfx",
x: x + (Math.random() - 0.5) * 14,
y: y - 16,
vy: -48,
tilt: (Math.random() - 0.5) * 0.26,
text: finalText,
life: 0,
maxLife: 0.6,
color: fillColor,
outline
});
this.wake();
}
emitImpact(x, y, color, { sfx = "", scale = 1, dirX = 0, sfxY = y - 4 } = {}) {
const mode = this.getMode();
if (mode === "enterprise") return;
if (mode === "elastic") {
this.emitShockwave(x, y, color, Math.round(52 * scale));
this.emitSmoke(x, y, color, dirX);
} else if (mode === "glitch") {
this.emitPixels(x, y, color, Math.round(12 * scale));
this.emitScanline(x, y, color, Math.round(96 * scale));
} else if (mode === "neon") {
this.emitShockwave(x, y, color, Math.round(58 * scale));
this.emitRays(x, y, color, Math.round(9 * scale), Math.round(52 * scale));
} else if (mode === "ink") {
this.emitInkSplatter(x, y, color, Math.round(13 * scale));
} else {
this.emitShockwave(x, y, color, Math.round(50 * scale));
this.emitBurst(x, y, color, {
count: Math.round(12 * scale),
speed: Math.round(210 * scale),
spread: dirX ? 1.8 : Math.PI * 2,
baseAngle: dirX < 0 ? Math.PI : 0
});
this.emitSlash(x, y, color, -0.28);
}
this.emitMangaSFX(x, sfxY, sfx, color);
}
render(dt) {
const ctx = this.ctx;
ctx.clearRect(0, 0, window.innerWidth, window.innerHeight);
const next = [];
for (const p of this.items) {
p.life += dt;
if (p.life >= p.maxLife) continue;
const t = p.life / p.maxLife;
const easeOut = 1 - Math.pow(1 - t, 3);
const alpha = Math.max(0, 1 - Math.pow(t, 2));
ctx.save();
ctx.globalAlpha = alpha;
if (p.kind === "spark" || p.kind === "shard") {
p.vx *= Math.pow(p.drag, dt * 60);
p.vy = p.vy * Math.pow(p.drag, dt * 60) + p.gravity * dt;
p.x += p.vx * dt;
p.y += p.vy * dt;
p.rot += p.vrot * dt;
ctx.translate(p.x, p.y);
ctx.rotate(p.rot);
ctx.fillStyle = p.color;
if (p.kind === "shard") {
const s = p.size * (1 - t * 0.4);
ctx.beginPath();
ctx.moveTo(0, -s);
ctx.lineTo(s * 0.72, 0);
ctx.lineTo(0, s);
ctx.lineTo(-s * 0.72, 0);
ctx.closePath();
ctx.fill();
} else {
ctx.beginPath();
ctx.arc(0, 0, p.size * 0.5 * (1 - t * 0.5), 0, Math.PI * 2);
ctx.fill();
}
} else if (p.kind === "ring") {
const r = p.radius + (p.maxRadius - p.radius) * easeOut;
ctx.strokeStyle = p.color;
ctx.lineWidth = Math.max(1, 3 * (1 - t));
ctx.beginPath();
ctx.arc(p.x, p.y, r, 0, Math.PI * 2);
ctx.stroke();
} else if (p.kind === "slash") {
ctx.translate(p.x, p.y);
ctx.rotate(p.angle);
const len = p.length * easeOut;
const th = 4.5 * (1 - t);
ctx.fillStyle = p.color;
ctx.beginPath();
ctx.moveTo(-len, 0);
ctx.quadraticCurveTo(0, -th, len, 0);
ctx.quadraticCurveTo(0, th, -len, 0);
ctx.fill();
} else if (p.kind === "smoke") {
p.x += p.vx * dt;
p.y += p.vy * dt;
const r = p.size * (0.8 + easeOut * 1.25);
ctx.fillStyle = p.color;
ctx.globalAlpha = 0.24 * (1 - t);
ctx.beginPath();
ctx.arc(p.x, p.y, r, 0, Math.PI * 2);
ctx.fill();
} else if (p.kind === "pixel") {
p.x += p.vx * dt;
p.y += p.vy * dt;
ctx.fillStyle = p.color;
const s = p.size * (1 - t * 0.35);
ctx.fillRect(Math.round(p.x - s / 2), Math.round(p.y - s / 2), s, s);
} else if (p.kind === "scanline") {
const w = p.width * (0.4 + easeOut * 0.8);
ctx.fillStyle = p.color;
ctx.fillRect(p.x - w / 2, p.y, w, 2);
} else if (p.kind === "ray") {
const inner = 12 + easeOut * 16;
const outer = inner + p.maxRadius * (1 - t * 0.35);
ctx.strokeStyle = p.color;
ctx.shadowColor = p.color;
ctx.shadowBlur = 10;
ctx.lineWidth = Math.max(1, 2.8 * (1 - t));
ctx.beginPath();
ctx.moveTo(p.x + Math.cos(p.angle) * inner, p.y + Math.sin(p.angle) * inner);
ctx.lineTo(p.x + Math.cos(p.angle) * outer, p.y + Math.sin(p.angle) * outer);
ctx.stroke();
} else if (p.kind === "inkblot") {
p.vx *= Math.pow(p.drag, dt * 60);
p.vy = p.vy * Math.pow(p.drag, dt * 60) + p.gravity * dt;
p.x += p.vx * dt;
p.y += p.vy * dt;
ctx.fillStyle = p.color;
ctx.beginPath();
ctx.arc(p.x, p.y, p.size * (1 - t * 0.45), 0, Math.PI * 2);
ctx.fill();
} else if (p.kind === "brusharc") {
const sweep = p.startAngle + (p.endAngle - p.startAngle) * easeOut;
ctx.strokeStyle = p.color;
ctx.lineCap = "round";
ctx.lineWidth = Math.max(1.5, 6 * (1 - t));
ctx.beginPath();
ctx.arc(p.x, p.y, p.radius * (0.85 + easeOut * 0.4), p.startAngle, sweep);
ctx.stroke();
} else if (p.kind === "sfx") {
p.y += p.vy * dt * (1 - t * 0.6);
const s = t < 0.18 ? 0.55 + (t / 0.18) * 0.65 : 1.2 - (t - 0.18) * 0.25;
ctx.translate(p.x, p.y);
ctx.rotate(p.tilt);
ctx.scale(s, s);
ctx.font = '900 19px "Hiragino Kaku Gothic ProN", "Yu Gothic", system-ui, sans-serif';
ctx.textAlign = "center";
ctx.textBaseline = "middle";
ctx.lineJoin = "round";
ctx.lineWidth = 4.5;
ctx.strokeStyle = p.outline;
ctx.strokeText(p.text, 0, 0);
ctx.fillStyle = p.color;
ctx.fillText(p.text, 0, 0);
}
ctx.restore();
next.push(p);
}
this.items = next;
}
}
const SakugaFX = new SakugaVFXEngine(document.getElementById("sakuga-vfx-canvas"));
window.SakugaFX = SakugaFX;
window.readAccent = readAccent;
window.contrastInk = contrastInk;
Attributes
| Name | What it does | Default |
|---|---|---|
value | Current amount, from 0 up to max. Change it to animate. | 0 |
max | The amount that counts as 100%. | 100 |
label | Text shown above the bar and used as its accessible name. | — |
variant | "bar" or "ring" (a circular SVG). | bar |
indeterminate | Unknown duration: show a sliding or spinning indicator. | — |
Keyboard and screen readers
- role="progressbar" with aria-valuemin, aria-valuemax, aria-valuenow and a text value such as "68%".
- Indeterminate mode drops aria-valuenow, as the ARIA pattern asks.
- The label names the bar. Reaching the maximum is announced once through a polite live region.
- The bar is not focusable. With reduced motion the fill jumps and the indeterminate bar is static.
Styling variables
Every look is a CSS variable: --kt-accent, --kt-accent-ink, --kt-radius-btn, --kt-surface-radius, --kt-surface-bg, --kt-border-w, --kt-comp-shadow and --font-sans. The
copied file sets them all from your choices.
FAQ
Kinetic Progress: questions answered
How do I use the Kinetic Progress?
Press Copy on the card to get a complete HTML file, or copy the HTML, CSS and JavaScript tabs into your own page. In your markup the element is written as <kt-kinetic-progress>.
Which attributes does <kt-kinetic-progress> accept?
value, max, label, variant, indeterminate. Each one is described in the attributes table on this page.
Is the Kinetic Progress accessible?
role="progressbar" with aria-valuemin, aria-valuemax, aria-valuenow and a text value such as "68%". Indeterminate mode drops aria-valuenow, as the ARIA pattern asks. The label names the bar. Reaching the maximum is announced once through a polite live region. The bar is not focusable. With reduced motion the fill jumps and the indeterminate bar is static.
Can I change the Kinetic Progress colors, corners and font?
Yes. Use the options on this page: accent color, border radius, background, border, shadow and Google font. The copied code already contains your choices, and every one of them is a CSS variable you can edit later.