Expand description
Built-in animation effects for nodes.
Two families, distinguished by how they handle time and by when they stop:
- Event-driven effects (
Animation::pulse,Animation::ripple,Animation::countdown_arc,Animation::scale_in,Animation::crosshair) are anchored to theInstantan event happened and terminate: they returntruewhile still playing andfalseonce finished, so the caller can drop the entry and stop repainting. - Persistent effects (
Animation::halo,Animation::blink,Animation::orbit) never end. They take the frame time in seconds (ui.input(|i| i.time)) rather than anInstant, so every element animated in the same frame shares one clock and cannot drift apart.
Persistent effects require the caller to keep requesting repaints, which turns an idle app into one redrawing continuously — use them for a handful of elements, not for every node.
Both families are reached through
Map::node; see NodeHandle.
They are also useful from a custom
NodeTemplate: call them from
notification_ui / marker_ui instead of reimplementing the effect. When
you do, remember to call ui.ctx().request_repaint() yourself — the widget
only does that for its own built-in path.
Structs§
- Animation
- Factory for the built-in node animations.
Constants§
- COUNTDOWN_
DURATION - How long
Animation::countdown_arctakes to empty, in seconds. - CROSSHAIR_
DURATION - How long
Animation::crosshairtakes to converge, in seconds. - PULSE_
DURATION - How long
Animation::pulseplays, in seconds. - RIPPLE_
DURATION - How long
Animation::rippleplays, in seconds. - SCALE_
IN_ DURATION - How long
Animation::scale_inplays, in seconds.