Skip to main content

animate

Function animate 

Source
pub fn animate(
    clock: FrameClock,
    timing: Timing,
    step: impl FnMut(Sample) + 'static,
) -> FrameHandle
Expand description

Call step(sample) once per display frame of clock until timing is done, then stop.

Elapsed time is measured from the first frame delivered, not from this call, so a transition started while the app is busy begins on screen rather than part-way through. The final call has sample.done == true and the exact end value; after it the subscription ends and the window requests no more frames on this transition’s behalf. Keep the handle, or call FrameHandle::in_scope: dropping it cancels the transition where it stands.

Day API ↩ Guides· daybrite.dev