INNER CODE UNIT · TypeScript

onTick

WorldQL/dreamlab-engine · engine/_web/main.ts:68

const onTick = (time: number) => {
  now = time;
  delta = now - then;
  const FRAME_TIME = 1000 / MAX_FPS;

  if (delta >= FRAME_TIME) {
    then = now - (delta % FRAME_TIME);
    game.tickClient(delta);
  } else {
    console.log("skipped");
  }

  requestAnimationFrame(onTick);
};

requestAnimationFrame(onTick);

const FPS_TEST_MODE = false;

View source record →

📰 Research Paper
Loading…
⏳ Fetching content…