mirror of
https://github.com/CommunityOx/ox_lib.git
synced 2026-08-16 22:46:03 +01:00
* 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>