Senlar f33c613b6d Fix: Skillcheck animation speed inconsistencies by switching to time-… (#66)
* Fix: Skillcheck animation speed inconsistencies by switching to time-based RAF loop

This PR fixes long-standing issues with the skillcheck mini-game animation speed being inconsistent across machines and after long play sessions. Some players reported extremely slow indicator movement, others extremely fast, and many noticed that the speed changed unpredictably the longer they stayed logged in.

The root cause was that the skillcheck relied on a useInterval tick (setInterval-like behavior) and assumed it fired every 1ms. In reality, browser timer clamping and throttling make interval timing highly unpredictable — especially in embedded CEF browsers like FiveM’s NUI.

This PR replaces tick-based animation with a time-based requestAnimationFrame loop using performance.now(), ensuring perfectly consistent animation timing across all hardware and browser states. I have used this method in other NUI based skillcheck scripts to address this same behavior.

Signed-off-by: Senlar <brandonrhue@gmail.com>

* Refactor keyHandler and clean up code

Signed-off-by: Senlar <brandonrhue@gmail.com>

* Refactor keyHandler and cleanup useEffect logic again

Signed-off-by: Senlar <brandonrhue@gmail.com>

---------

Signed-off-by: Senlar <brandonrhue@gmail.com>
2026-02-11 18:22:54 +01:00
2022-11-24 17:02:03 +11:00
2025-12-21 17:18:40 +00:00
2022-07-05 05:17:52 +10:00
2025-03-29 22:02:36 +11:00

ox_lib

A FiveM library and resource implementing reusable modules, methods, and UI elements.

For guidelines to contributing to the project, and to see our Contributor License Agreement, see CONTRIBUTING.md

For additional legal notices, refer to NOTICE.md.

📚 Documentation

https://coxdocs.dev/ox_lib

💾 Download

https://github.com/communityox/ox_lib/releases/latest/download/ox_lib.zip

📦 npm package

https://www.npmjs.com/package/@communityox/ox_lib

🖥️ Lua Language Server

  • Install Lua Language Server to ease development with annotations, type checking, diagnostics, and more.
  • Install CfxLua IntelliSense to add natives and cfxlua runtime declarations to LLS.
  • You can load ox_lib into your global development environment by modifying workspace/user settings "Lua.workspace.library" with the resource path.
    • e.g. "c:/fxserver/resources/ox_lib"
Description
No description provided
Readme 5.7 MiB
Languages
Lua 62.5%
TypeScript 35.6%
CSS 1.7%