Kinetic Steps
A step-by-step progress indicator whose finished steps draw a check; completed steps can be revisited, with optional Previous and Next buttons.
- <kt-kinetic-steps>
- Navigation
- No framework
The code
Copy the Kinetic Steps
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-steps items="Account,Shipping,Payment,Review" active="1" controls label="Checkout progress"></kt-kinetic-steps>
<kt-kinetic-steps items="Plan,Build,Test,Ship" active="2" orientation="vertical" label="Release stages"></kt-kinetic-steps>
kt-kinetic-steps {
display: block;
width: 100%;
max-width: 460px;
}
.kt-steps {
--_color: var(--kt-accent);
--_ink: var(--kt-accent-ink);
--_marker: 30px;
position: relative;
box-sizing: border-box;
padding: 16px 14px 14px;
border-radius: var(--kt-surface-radius);
border-style: solid;
border-width: var(--kt-card-border-w);
border-color: var(--kt-comp-border, var(--kt-surface-border));
background: var(--kt-surface-bg);
color: var(--kt-surface-ink);
box-shadow: var(--kt-comp-shadow);
transition: border-color 160ms ease, box-shadow 180ms ease, border-width 150ms ease;
}
.kt-steps-list {
display: flex;
margin: 0;
padding: 0;
list-style: none;
}
.kt-step {
position: relative;
flex: 1 1 0;
min-width: 0;
margin: 0;
padding: 0;
}
.kt-step-hit {
display: flex;
flex-direction: column;
align-items: center;
gap: 8px;
width: 100%;
padding: 0 2px;
border: 0;
background: transparent;
color: inherit;
font: inherit;
text-align: center;
cursor: default;
border-radius: var(--kt-radius-btn);
}
button.kt-step-hit {
cursor: pointer;
}
.kt-step-hit:focus-visible {
outline: 2px solid var(--kt-surface-ink);
outline-offset: 3px;
}
.kt-step-marker {
position: relative;
z-index: 1;
display: inline-flex;
align-items: center;
justify-content: center;
flex-shrink: 0;
box-sizing: border-box;
width: var(--_marker);
height: var(--_marker);
border-radius: var(--kt-radius-thumb);
border-style: solid;
border-width: var(--kt-border-w);
border-color: var(--kt-comp-border, var(--kt-surface-border));
background: var(--kt-surface-bg);
color: var(--kt-surface-muted);
font-family: var(--font-mono);
font-size: 12px;
font-weight: 700;
line-height: 1;
transition: background-color 220ms ease, border-color 220ms ease, color 220ms ease, transform 260ms var(--ease-overshoot), box-shadow 220ms ease;
}
.kt-step-num {
transition: opacity 120ms ease, transform 200ms var(--ease-snap);
}
.kt-step-check {
position: absolute;
inset: 0;
margin: auto;
opacity: 0;
}
.kt-step-check path {
stroke-dasharray: 1;
stroke-dashoffset: 1;
transition: stroke-dashoffset 340ms var(--ease-snap) 80ms;
}
.kt-step[data-state="current"] .kt-step-marker {
border-color: var(--_color);
color: var(--kt-surface-ink);
box-shadow: 0 0 0 3px color-mix(in srgb, var(--_color) 28%, transparent);
transform: scale(1.06);
}
.kt-step[data-state="complete"] .kt-step-marker {
border-color: var(--_color);
background: var(--_color);
color: var(--_ink);
}
.kt-step[data-state="complete"] .kt-step-num {
opacity: 0;
transform: scale(0.4);
}
.kt-step[data-state="complete"] .kt-step-check {
opacity: 1;
}
.kt-step[data-state="complete"] .kt-step-check path {
stroke-dashoffset: 0;
}
button.kt-step-hit:hover .kt-step-marker {
transform: scale(1.1);
}
[data-vfx="neon"] .kt-step[data-state="complete"] .kt-step-marker,
[data-vfx="neon"] .kt-step[data-state="current"] .kt-step-marker {
box-shadow: 0 0 14px -2px color-mix(in srgb, var(--_color) 75%, transparent);
}
[data-vfx="elastic"] .kt-step-marker {
transition-timing-function: cubic-bezier(0.34, 1.56, 0.64, 1);
}
[data-vfx="glitch"] .kt-step-check path {
transition: stroke-dashoffset 220ms steps(5, end);
}
[data-vfx="enterprise"] .kt-step-marker {
transition: background-color 140ms ease, border-color 140ms ease, color 140ms ease;
}
[data-vfx="enterprise"] .kt-step-check path {
transition: stroke-dashoffset 160ms ease;
}
[data-vfx="enterprise"] .kt-step[data-state="current"] .kt-step-marker,
[data-vfx="enterprise"] button.kt-step-hit:hover .kt-step-marker {
transform: none;
}
.kt-step-text {
display: flex;
flex-direction: column;
align-items: center;
gap: 2px;
min-width: 0;
max-width: 100%;
}
.kt-step-title {
max-width: 100%;
overflow-wrap: anywhere;
font-family: var(--font-sans);
font-size: 12.5px;
font-weight: 700;
line-height: 1.25;
color: var(--kt-surface-muted);
transition: color 160ms ease;
}
.kt-step[data-state="current"] .kt-step-title,
.kt-step[data-state="complete"] .kt-step-title {
color: var(--kt-surface-ink);
}
.kt-step-state {
font-family: var(--font-mono);
font-size: 9.5px;
font-weight: 700;
letter-spacing: 0.06em;
text-transform: uppercase;
color: var(--kt-surface-muted);
}
.kt-step[data-state="current"] .kt-step-state {
color: var(--_color);
}
/* connector between this marker and the next one */
.kt-step-line {
position: absolute;
top: calc(var(--_marker) / 2 - 1px);
left: calc(50% + var(--_marker) / 2 + 4px);
right: calc(-50% + var(--_marker) / 2 + 4px);
height: 2px;
border-radius: 2px;
background: color-mix(in srgb, var(--kt-surface-ink) 14%, transparent);
overflow: hidden;
}
.kt-step-line i {
display: block;
width: 100%;
height: 100%;
background: var(--_color);
transform: scaleX(0);
transform-origin: left center;
transition: transform 340ms var(--ease-snap);
}
.kt-step-line[data-filled="true"] i {
transform: scaleX(1);
}
[data-vfx="enterprise"] .kt-step-line i {
transition: transform 160ms ease;
}
/* vertical layout */
.kt-steps[data-orientation="vertical"] .kt-steps-list {
flex-direction: column;
}
.kt-steps[data-orientation="vertical"] .kt-step {
flex: none;
padding-bottom: 18px;
}
.kt-steps[data-orientation="vertical"] .kt-step:last-child {
padding-bottom: 0;
}
.kt-steps[data-orientation="vertical"] .kt-step-hit {
flex-direction: row;
align-items: flex-start;
gap: 12px;
text-align: left;
padding: 0;
}
.kt-steps[data-orientation="vertical"] .kt-step-text {
align-items: flex-start;
padding-top: 2px;
}
.kt-steps[data-orientation="vertical"] .kt-step-line {
top: calc(var(--_marker) + 4px);
bottom: 4px;
left: calc(var(--_marker) / 2 - 1px);
right: auto;
width: 2px;
height: auto;
}
.kt-steps[data-orientation="vertical"] .kt-step-line i {
transform: scaleY(0);
transform-origin: center top;
}
.kt-steps[data-orientation="vertical"] .kt-step-line[data-filled="true"] i {
transform: scaleY(1);
}
.kt-steps-controls {
display: flex;
justify-content: space-between;
gap: 8px;
margin-top: 16px;
padding-top: 12px;
border-top: 1px solid var(--kt-comp-border, var(--kt-surface-border));
}
.kt-steps-btn {
min-height: 32px;
padding: 7px 14px;
border-style: solid;
border-width: var(--kt-border-w);
border-radius: var(--kt-radius-btn);
border-color: var(--kt-comp-border, var(--kt-surface-border));
background: transparent;
color: var(--kt-surface-ink);
font-family: var(--font-sans);
font-size: 12.5px;
font-weight: 700;
line-height: 1.2;
cursor: pointer;
transition: transform 140ms var(--ease-snap), border-color 160ms ease, opacity 160ms ease;
}
.kt-steps-next {
border-color: var(--_color);
background: var(--_color);
color: var(--_ink);
}
.kt-steps-btn:active {
transform: scale(0.97);
}
.kt-steps-btn[aria-disabled="true"] {
opacity: 0.4;
cursor: not-allowed;
transform: none;
}
.kt-steps-btn:focus-visible {
outline: 2px solid var(--kt-surface-ink);
outline-offset: 2px;
}
.kt-steps-status {
position: absolute;
width: 1px;
height: 1px;
margin: -1px;
overflow: hidden;
clip: rect(0 0 0 0);
white-space: nowrap;
}
@media (max-width: 380px) {
.kt-steps { --_marker: 26px; padding: 14px 8px 12px; }
.kt-step-title { font-size: 11.5px; }
}
class KtKineticSteps extends HTMLElement {
static get observedAttributes() {
return ["items", "active", "orientation", "controls", "label", "sfx"];
}
constructor() {
super();
this._rendered = false;
}
connectedCallback() {
if (!this._rendered) {
this.render();
this._rendered = true;
}
this.syncAttributes();
}
attributeChangedCallback(name) {
if (!this._rendered) return;
if (name === "items" || name === "controls" || name === "orientation") this.render();
this.syncAttributes();
}
get items() {
return (this.getAttribute("items") || "Account,Details,Review")
.split(",")
.map((s) => s.trim())
.filter(Boolean);
}
/** 0-based index of the current step; one past the last step means everything is done. */
get active() {
const idx = Math.trunc(Number(this.getAttribute("active") || 0));
return Number.isFinite(idx) ? Math.min(Math.max(0, idx), this.items.length) : 0;
}
set active(v) { this.setAttribute("active", String(v)); }
get vertical() { return this.getAttribute("orientation") === "vertical"; }
get controls() { return this.hasAttribute("controls"); }
get label() { return this.getAttribute("label") || "Progress"; }
get sfx() { return this.getAttribute("sfx") ?? "ピシッ!"; }
render() {
this.innerHTML = "";
const root = document.createElement("div");
root.className = "kt-steps";
root.setAttribute("data-orientation", this.vertical ? "vertical" : "horizontal");
const list = document.createElement("ol");
list.className = "kt-steps-list";
list.setAttribute("role", "list");
this._steps = this.items.map((text, idx) => {
const li = document.createElement("li");
li.className = "kt-step";
li.innerHTML = `
<span class="kt-step-line" aria-hidden="true"><i></i></span>
<span class="kt-step-hit">
<span class="kt-step-marker" aria-hidden="true">
<span class="kt-step-num"></span>
<svg class="kt-step-check" viewBox="0 0 20 20" width="16" height="16"><path d="M4.5 10.5l3.6 3.6 7.4-8" pathLength="1" fill="none" stroke="currentColor" stroke-width="2.4" stroke-linecap="round" stroke-linejoin="round"/></svg>
</span>
<span class="kt-step-text"><span class="kt-step-title"></span><span class="kt-step-state"></span></span>
</span>
`;
li.querySelector(".kt-step-num").textContent = String(idx + 1);
li.querySelector(".kt-step-title").textContent = text;
if (idx === this.items.length - 1) li.querySelector(".kt-step-line").remove();
list.appendChild(li);
return li;
});
list.addEventListener("click", (e) => {
const hit = e.target.closest("button.kt-step-hit");
if (!hit) return;
const idx = this._steps.indexOf(hit.closest(".kt-step"));
if (idx >= 0 && idx < this.active) this.goTo(idx, true);
});
root.appendChild(list);
this._status = document.createElement("span");
this._status.className = "kt-steps-status";
this._status.setAttribute("role", "status");
this._status.setAttribute("aria-live", "polite");
root.appendChild(this._status);
if (this.controls) {
const bar = document.createElement("div");
bar.className = "kt-steps-controls";
bar.innerHTML = `
<button type="button" class="kt-steps-btn kt-steps-prev">Previous</button>
<button type="button" class="kt-steps-btn kt-steps-next"></button>
`;
this._prev = bar.querySelector(".kt-steps-prev");
this._next = bar.querySelector(".kt-steps-next");
this._prev.addEventListener("click", () => {
if (this._prev.getAttribute("aria-disabled") !== "true") this.goTo(this.active - 1, true);
});
this._next.addEventListener("click", () => {
if (this._next.getAttribute("aria-disabled") !== "true") this.goTo(this.active + 1, true);
});
root.appendChild(bar);
} else {
this._prev = this._next = null;
}
this._root = root;
this._list = list;
this._announced = false;
this.appendChild(root);
}
syncAttributes() {
if (!this._root) return;
const active = this.active;
const count = this._steps.length;
this._root.setAttribute("aria-label", this.label);
this._list.setAttribute("aria-label", this.label);
this._steps.forEach((li, idx) => {
const state = idx < active ? "complete" : idx === active ? "current" : "upcoming";
const title = li.querySelector(".kt-step-title").textContent;
li.setAttribute("data-state", state);
if (state === "current") li.setAttribute("aria-current", "step");
else li.removeAttribute("aria-current");
li.querySelector(".kt-step-state").textContent =
state === "complete" ? "Completed" : state === "current" ? "In progress" : "Not started";
const line = li.querySelector(".kt-step-line");
if (line) line.setAttribute("data-filled", String(idx < active));
// only completed steps are interactive, so only they are buttons
const hit = li.querySelector(".kt-step-hit");
const want = state === "complete" ? "button" : "span";
if (hit.tagName.toLowerCase() !== want) {
const hadFocus = hit === document.activeElement;
const repl = document.createElement(want);
repl.className = "kt-step-hit";
while (hit.firstChild) repl.appendChild(hit.firstChild);
hit.replaceWith(repl);
if (want === "button") repl.type = "button";
else if (hadFocus) repl.tabIndex = -1;
if (hadFocus) this._refocus = repl;
}
const el = li.querySelector(".kt-step-hit");
if (want === "button") el.setAttribute("aria-label", `Step ${idx + 1}: ${title}, completed. Go back to this step`);
else el.removeAttribute("aria-label");
});
if (this._refocus) {
this._refocus.focus({ preventScroll: true });
this._refocus = null;
}
if (this._prev) {
this._prev.setAttribute("aria-disabled", String(active <= 0));
this._next.setAttribute("aria-disabled", String(active >= count));
this._next.textContent = active >= count - 1 ? (active >= count ? "Done" : "Finish") : "Next";
}
const text = active >= count
? `All ${count} steps complete`
: `Step ${active + 1} of ${count}: ${this._steps[active].querySelector(".kt-step-title").textContent}`;
this._status.textContent = this._announced ? text : "";
this._announced = true;
}
goTo(target, fromUser) {
const count = this._steps.length;
const next = Math.min(Math.max(0, target), count);
const prev = this.active;
if (next === prev) return;
this.active = next;
if (fromUser) {
this.dispatchEvent(new CustomEvent("change", {
bubbles: true,
detail: { active: next, label: this._steps[next]?.querySelector(".kt-step-title").textContent ?? null }
}));
}
if (SakugaFX.getMode() === "enterprise") return;
const li = this._steps[Math.min(next > prev ? next - 1 : next, count - 1)];
const marker = li?.querySelector(".kt-step-marker");
if (!marker) return;
const r = marker.getBoundingClientRect();
SakugaFX.emitImpact(r.left + r.width / 2, r.top + r.height / 2, readAccent(this._root), {
sfx: this.sfx, scale: 0.7, dirX: next > prev ? 1 : -1, sfxY: r.top - 4
});
}
}
customElements.define("kt-kinetic-steps", KtKineticSteps);
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 |
|---|---|---|
items | Comma-separated step names. | Account,Details,Review |
active | Index of the current step, starting at 0. One past the last step marks every step done. | 0 |
orientation | "horizontal" or "vertical". | horizontal |
controls | Present to show Previous and Next buttons. | — |
label | Accessible name of the list. | Progress |
sfx | Sound-effect text when a step changes. | ピシッ! |
Keyboard and screen readers
- An ordered list; the current step has aria-current="step" and every step shows Completed, In progress or Not started as text.
- Completed steps are buttons you can Tab to and press to go back; later steps are not interactive.
- Previous and Next use aria-disabled at the ends so focus is never lost.
- A polite live region announces "Step N of M" when the step changes.
- Fires a change event with the new active index.
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 Steps: questions answered
How do I use the Kinetic Steps?
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-steps>.
Which attributes does <kt-kinetic-steps> accept?
items, active, orientation, controls, label, sfx. Each one is described in the attributes table on this page.
Is the Kinetic Steps accessible?
An ordered list; the current step has aria-current="step" and every step shows Completed, In progress or Not started as text. Completed steps are buttons you can Tab to and press to go back; later steps are not interactive. Previous and Next use aria-disabled at the ends so focus is never lost. A polite live region announces "Step N of M" when the step changes. Fires a change event with the new active index.
Can I change the Kinetic Steps 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.