summaryrefslogtreecommitdiffstats
path: root/site
diff options
context:
space:
mode:
authorBrian Cully <bjc@spork.org>2025-12-16 20:12:40 -0500
committerBrian Cully <bjc@spork.org>2025-12-16 20:12:40 -0500
commit44b194d3c71d5b0bae4f0d96c640b31cad292302 (patch)
treeb7443a272541281bdfb989b0f21ea8df2ab3f0da /site
parent3014a14b3a86681be15288f2495de6ae01196b42 (diff)
downloadautomathon-44b194d3c71d5b0bae4f0d96c640b31cad292302.tar.gz
automathon-44b194d3c71d5b0bae4f0d96c640b31cad292302.zip
js: don't run extra tick/frame after haltenblinken
Diffstat (limited to 'site')
-rw-r--r--site/main.mjs12
1 files changed, 9 insertions, 3 deletions
diff --git a/site/main.mjs b/site/main.mjs
index f4e1989..901b6ae 100644
--- a/site/main.mjs
+++ b/site/main.mjs
@@ -242,9 +242,13 @@ async function loaded() {
let lastTime;
function r(t, manual=false) {
- if (blinkenRun && !manual) {
+ if (!blinkenRun) {
+ return;
+ }
+ if (!manual) {
window.requestAnimationFrame(r);
}
+
const delta = (lastTime === undefined) ? 0 : t - lastTime;
lastTime = t;
if (delta > 0) {
@@ -260,9 +264,11 @@ async function loaded() {
e.target.textContent = 'blinken';
}
const onTimeout = _ => {
- if (blinkenRun) {
- setTimeout(onTimeout, MS_PER_TICK);
+ if (!blinkenRun) {
+ return
}
+ setTimeout(onTimeout, MS_PER_TICK);
+
tick(robo);
r(document.timeline.currentTime, true);
}