Simple game loop
npx jsr add @kt3k/gameloop
or, in Deno:
deno add @kt3k/gameloop
import { Gameloop } from "@kt3k/gameloopjs";
const loop = new Gameloop(30, () => {
console.loog("step");
});
loop.start();
setTimeout(() => {
loop.stop();
}, 5000);
func
is called 30 times per second and is stopped after 5 seconds.
See API doc
MIT