pub fn frame_clock(tick: impl FnMut(Duration) + 'static) -> AnyPieceExpand description
A frame clock (§8.4): an invisible, zero-size piece that calls tick every animation frame with
the wall-clock delta since the previous frame, for as long as it is mounted. Drop it into the
tree (e.g. behind a canvas in a zstack) to drive a game loop or self-driven animation: the
tick mutates state Signals, and a canvas reading them re-records that frame.
Backend-executed vsync: Day re-arms the platform’s display link only while a frame_clock (or
other consumer) is live and stops when the last one unmounts — no idle wakeups. The delta is
clamped (≤100 ms) so a backgrounded window can’t deliver a huge jump.
ⓘ
zstack((
canvas(move |d, sz| draw(d, sz, state)).grow(),
frame_clock(move |dt| step(dt, state)),
))