aboutsummaryrefslogtreecommitdiffstats
path: root/site
diff options
context:
space:
mode:
Diffstat (limited to 'site')
-rw-r--r--site/main.css6
-rw-r--r--site/main.mjs6
2 files changed, 11 insertions, 1 deletions
diff --git a/site/main.css b/site/main.css
index f875232..19a3835 100644
--- a/site/main.css
+++ b/site/main.css
@@ -9,3 +9,9 @@ canvas {
border: 1px solid orangered;
background-color: rgb(200 200 200);
}
+
+#fps {
+ display: inline-block;
+ width: 2em;
+ text-align: right;
+}
diff --git a/site/main.mjs b/site/main.mjs
index 280ee43..f3571ec 100644
--- a/site/main.mjs
+++ b/site/main.mjs
@@ -222,10 +222,14 @@ async function loaded() {
};
let lastTime = document.timeline.currentTime;
+ let interCount = 0;
function render(t) {
if (t > lastTime) {
- fps.textContent = Math.floor(1_000 / (t - lastTime));
+ fps.textContent = Math.floor(1_000 * interCount / (t - lastTime));
lastTime = t;
+ interCount = 0;
+ } else {
+ interCount++;
}
ctx.clearRect(0, 0, canvas.width, canvas.height);