Expand description
Built-in animation effects for nodes and segments.
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,Animation::flash_decay,Animation::comet_once,Animation::wipe) 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,Animation::comet,Animation::dash,Animation::glow_band,Animation::chevrons) 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 or segment.
The node effects 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.
The segment effects (Animation::flash_decay, Animation::comet_once,
Animation::wipe, Animation::comet, Animation::dash,
Animation::glow_band, Animation::chevrons) are reached the same way, through
Map::segment; see
SegmentHandle. A custom
SegmentTemplate calls them from
segment_notification_ui / segment_state_ui, remembering to call
painter.ctx().request_repaint() itself.
Structs§
- Animation
- Factory for the built-in node animations.
Constants§
- CHEVRON_
PERIOD_ PX - Length, in screen pixels, of one chevron repeat of
Animation::chevrons. Deliberately not scaled by zoom, same reasoning asDASH_PERIOD_PX. - CHEVRON_
SPEED - How many repeats of the chevron pattern
Animation::chevronsslides through per second. - CHEVRON_
WIDTH - Width, before the
zoommultiplier, of the ribbonAnimation::chevronspaints. - COMET_
PERIOD - How long
Animation::comettakes for one end-to-end pass, in seconds. - COMET_
TRAVEL_ DURATION - How long a single
Animation::comet_oncepass takes to cross the segment, in seconds. - COUNTDOWN_
DURATION - How long
Animation::countdown_arctakes to empty, in seconds. - CROSSHAIR_
DURATION - How long
Animation::crosshairtakes to converge, in seconds. - DASH_
PERIOD_ PX - Length, in screen pixels, of one dash-plus-gap repeat of
Animation::dash. Deliberately not scaled by zoom, same as the dash speed, so the pattern doesn’t stretch as the map is zoomed – matching how node/label text is sized in screen space rather than map space. - DASH_
SPEED - How many repeats of the dash pattern
Animation::dashslides through per second (“marching ants” speed). - DASH_
WIDTH - Width, before the
zoommultiplier, of the ribbonAnimation::dashpaints. - FLASH_
DECAY_ DURATION - How long
Animation::flash_decaytakes to fade back out, in seconds. - GLOW_
BAND_ LENGTH_ PX - Length, in screen pixels, of the visible glow band
Animation::glow_bandpaints. Deliberately not scaled by zoom, same reasoning asDASH_PERIOD_PX. - GLOW_
BAND_ PERIOD - How long one full traverse-and-loop of
Animation::glow_bandtakes, in seconds – the band fades out past one end before it reappears at the other, so this covers the whole cycle, not just the visible crossing. - GLOW_
BAND_ THICKNESS - Width, before the
zoommultiplier, of the ribbonAnimation::glow_bandpaints. - 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. - WIPE_
DURATION - How long
Animation::wipetakes to draw the line in, in seconds.