From 525839712104de5a8640d95eb52affae76d0af03 Mon Sep 17 00:00:00 2001 From: mileswa1q22 <115095719+mileswolfallen2@users.noreply.github.com> Date: Wed, 20 Dec 2023 15:01:15 +0000 Subject: [PATCH] idk --- fun.js | 17 ++++++++++++++++- index.html | 1 + 2 files changed, 17 insertions(+), 1 deletion(-) diff --git a/fun.js b/fun.js index 3370a60c..8aea8ca2 100644 --- a/fun.js +++ b/fun.js @@ -15,4 +15,19 @@ alert("fun yesss🎅🏼 you found santa congrats you won") } function yourmom(){ alert("your mom still in testing") - } \ No newline at end of file + } + var fps = document.getElementById("fps"); +var startTime = Date.now(); +var frame = 0; + +function tick() { + var time = Date.now(); + frame++; + if (time - startTime > 1000) { + fps.innerHTML = (frame / ((time - startTime) / 1000)).toFixed(1); + startTime = time; + frame = 0; + } + window.requestAnimationFrame(tick); +} +tick(); \ No newline at end of file diff --git a/index.html b/index.html index 91c0b92a..f991cbd1 100644 --- a/index.html +++ b/index.html @@ -3,6 +3,7 @@ Home + -- FPS