RequestBeforeAnimationFrame
The RequestBeforeAnimationFrame method, part of the VSyncObserver class, schedules a function to be executed just before the next screen repaint, synchronized with the VSync signal. Unlike RequestAnimationFrame, callbacks registered with this method are guaranteed to be executed before any standard animation frame callbacks. This is useful for tasks that need to update state or perform calculations before other visual updates occur in the same frame.
This method also provides two overloads for C++ std::function and C-style function pointers.
Method Signature
With std::function callback
With C-function callback
Parameters
Callback Functions
The C++ lynx::pub::VSyncObserverCallback signature is:
The C vsync_observer_callback signature is:
Example
This example demonstrates how to schedule a high-priority task before other animations.
Compatibility
LCD tables only load in the browser