use motion::{AppExt as _, Fade, MotionSpec, Painter};
motion::menu_in("menu", menu) // a catalog entrance
let fade = Fade::new(Painter::of(cx), "row-3"); // a hover wash
div()
.on_hover(motion::hover_listener(fade.clone()))
.bg(motion::hover_blend(&fade, theme.surface, theme.element_hover))
const BREATHE: MotionSpec = MotionSpec::new(1800, motion::EASE_IN_OUT);
let phase = motion::pulse_delta(&BREATHE, Painter::of(cx), cx); // in render
cx.set_reduced_motion(true);- A repeating animation goes through
pulse_deltaorPainter::lease, renewed every render.with_animation(..).repeat()holds the whole window at the display's rate while mounted. - A
Fadekey need only be unique within its view. Read the sameFadeinhover_listenerandhover_blend. menu_outtakes its eased progress from the caller:with_animation's clock restarts from 0 on remount.- Animation stops while the app is not frontmost;
cx.set_pause_when_inactive(false)keeps it running. Reduced motion snaps every element, andpulse_deltareturns 0.