From ef4807c680711a868d67b027a6fb618b920139ad Mon Sep 17 00:00:00 2001 From: Brian Cully Date: Mon, 22 Dec 2025 19:22:21 -0500 Subject: js: rename r → renderFrame MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- site/main.mjs | 10 ++++------ 1 file changed, 4 insertions(+), 6 deletions(-) (limited to 'site') diff --git a/site/main.mjs b/site/main.mjs index b5bd16c..46fea5f 100644 --- a/site/main.mjs +++ b/site/main.mjs @@ -161,6 +161,7 @@ function loadForth(taintedPath) { } async function loaded() { + const canvas = document.querySelector(CANVAS_SELECTOR); const roboWorker = new Worker('robo.mjs', { type: 'module' }); const robo = { worker: roboWorker, @@ -203,7 +204,6 @@ async function loaded() { robo.lastTick = document.timeline.currentTime; - const canvas = document.querySelector(CANVAS_SELECTOR); const [x, y] = clamp(25, robo.x + robo.speedx, robo.y + robo.speedy, canvas.width, canvas.height); robo.x = x; robo.y = y; @@ -263,13 +263,11 @@ async function loaded() { console.debug('blinken clicked', e); let lastTime = 0; - function r(t, manual=false) { + function renderFrame(t) { if (!blinkenRun) { return; } - if (!manual) { - window.requestAnimationFrame(r); - } + window.requestAnimationFrame(renderFrame); // we often get called with the same time stamp many times // in a row due to fingerprint-reduction tech. @@ -286,7 +284,7 @@ async function loaded() { blinkenRun = !blinkenRun; if (blinkenRun) { e.target.textContent = 'haltenblinken'; - r(document.timeline.currentTime); + renderFrame(document.timeline.currentTime); } else { e.target.textContent = 'blinken'; } -- cgit v1.3