Skip to main content

FrameEffect

Function FrameEffect 

Source
pub fn FrameEffect<K: PartialEq + 'static>(
    keys: K,
    running: bool,
    on_frame: impl FnMut(u64) + 'static,
)
Expand description

Runs on_frame on every animation frame while running is true.

This is the framework-owned animation loop for games and other custom-drawn content. running is ordinary observable state the caller derives — a simulation flag, “the window is visible”, “a gesture is in progress” — and the loop starts and stops with it. There is no wake handle to hold and no scheduler to poke: stopping is a state change like any other.