summaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorBrian Cully <bjc@spork.org>2025-12-22 19:22:21 -0500
committerBrian Cully <bjc@spork.org>2025-12-22 19:22:21 -0500
commitef4807c680711a868d67b027a6fb618b920139ad (patch)
tree48e89dc00cfff25e227a4d98dd39686c9c31fe2f
parente3d02f915d1b2140657cc86fc84f59862eeba848 (diff)
downloadautomathon-ef4807c680711a868d67b027a6fb618b920139ad.tar.gz
automathon-ef4807c680711a868d67b027a6fb618b920139ad.zip
js: rename r → renderFrame
-rw-r--r--site/main.mjs10
1 files changed, 4 insertions, 6 deletions
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';
}