mirror of
https://github.com/CommunityOx/ox_lib.git
synced 2026-08-16 22:46:03 +01:00
f33c613b6d4715b294ed4c551c9102328bc150cc
* 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>
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
💾 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
Languages
Lua
62.5%
TypeScript
35.6%
CSS
1.7%