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