ok timer good

This commit is contained in:
awesomeuser 2023-07-08 21:17:02 +00:00
parent 763e8d35f6
commit 712ce5dbdd

View file

@ -79,6 +79,10 @@
</ul>
<script>
const fps = 30;
var minDt = 1 / fps;
var header = document.getElementById("header");
var awdog = document.getElementById("awdog");
@ -99,9 +103,9 @@
let dt = (timestamp - prevTime) / 1000;
prevTime = timestamp;
if (dt < 0.025) { // fps limiter (40fps)
await new Promise(r => setTimeout(r, 0.025 - dt));
dt = 0.025;
if (dt < minDt) { // fps limiter
await new Promise(r => setTimeout(r, minDt - dt));
dt = minDt;
}
// petting shake