Skip to content
Open
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
9 changes: 7 additions & 2 deletions docs/index.html
Original file line number Diff line number Diff line change
Expand Up @@ -350,6 +350,7 @@
max-height: 65vh;
width: auto;
height: auto;
image-rendering: pixelated;
}

/* Empty state */
Expand Down Expand Up @@ -740,6 +741,7 @@
// ── State ────────────────────────────────────────────────────────

let currentImageData = null;
let pendingRaf = null;

// ── DOM refs ─────────────────────────────────────────────────────

Expand Down Expand Up @@ -823,12 +825,15 @@
setStatus('working', 'processing…');
algoBadge.textContent = modeKey.replace(/_/g, '-');

requestAnimationFrame(() => {
if (pendingRaf !== null) cancelAnimationFrame(pendingRaf);
pendingRaf = requestAnimationFrame(() => {
pendingRaf = null;
const t0 = performance.now();

const result = ditherImage(
{ width: currentImageData.width, height: currentImageData.height, data: currentImageData.data },
scheme, mode, useSerpentine, toneComp, gamutComp,
scheme,
{ mode, serpentine: useSerpentine, tone: toneComp, gamut: gamutComp },
);

const elapsed = performance.now() - t0;
Expand Down