Skip to main content

on_frame

Function on_frame 

Source
pub fn on_frame(window: &NSWindow, f: impl FnMut(f64) + 'static) -> FrameLoop
Expand description

Calls f once per frame of the display window is on, in step with its refresh (60 or 120 Hz), with the frame’s target time in seconds. Runs in a batch, so signal updates and layout happen once per frame: the place to apply data that arrived since the last frame.

While the display isn’t drawing the window (asleep, screen locked, window occluded), a timer calls f 10 times a second instead, so live data keeps flowing in small steps rather than piling up.

Keep the returned FrameLoop; dropping it stops the calls.