Expand description
Frame clock / continuous-animation driver (§8.4, docs/animation.md).
Backends deliver a single vsync-aligned callback through day_spec::Platform::request_frame;
this driver owns the registry of frame CONSUMERS (game loops, self-driven interpolations) and
re-arms the backend each tick while any remain — stopping requests when none do, so an idle app
never wakes the display link (battery). Consumers receive the wall-clock delta since the previous
frame, clamped so a backgrounded/paused window can’t deliver a huge jump.
It is main-thread only (like the rest of the runtime): all state lives in a thread-local and the
backend guarantees request_frame/its callback run on the main thread.
Structs§
- Frame
Consumer - Identifies a registered frame consumer; pass it to
remove_frame_consumerto stop it.
Functions§
- add_
frame_ consumer - Register
cbto run every animation frame with the delta since the previous frame, and start the vsync loop if it wasn’t already running. Remove withremove_frame_consumer; theframe_clockpiece ties that to its scope so it stops when the piece unmounts. - frame_
consumer_ count - Live consumer count — for diagnostics/tests.
- install_
frame_ requester - Install the backend’s vsync requester (called once at launch by
launch_with).fforwards today_spec::Platform::request_frame. - remove_
frame_ consumer - Stop delivering frames to a consumer. When the last one is removed, the loop stops re-arming and the display link goes idle.