Skip to main content

use_animate

Function use_animate 

Source
pub fn use_animate(cx: &mut Cx<'_, '_>, on: bool, time: f32) -> f32
Expand description

egui’s animate_bool_with_time_and_easing behind a hook: 0 while on is false, 1 while it is true, and in between for time seconds after on flips, eased with cubic_out.

egui’s AnimationManager owns the value and asks for the repaints while it moves, so nothing is stored in the Store and the repaint policy (5.6) is untouched. No Store slot means no sweep either: the animation of a component that stops being drawn stays in egui’s memory at its last value, which is what animate_bool does for everyone.