Skip to main content

Module animation

Module animation 

Source
Expand description

Built-in animation effects for nodes and segments.

Two families, distinguished by how they handle time and by when they stop:

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 as DASH_PERIOD_PX.
CHEVRON_SPEED
How many repeats of the chevron pattern Animation::chevrons slides through per second.
CHEVRON_WIDTH
Width, before the zoom multiplier, of the ribbon Animation::chevrons paints.
COMET_PERIOD
How long Animation::comet takes for one end-to-end pass, in seconds.
COMET_TRAVEL_DURATION
How long a single Animation::comet_once pass takes to cross the segment, in seconds.
COUNTDOWN_DURATION
How long Animation::countdown_arc takes to empty, in seconds.
CROSSHAIR_DURATION
How long Animation::crosshair takes 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::dash slides through per second (“marching ants” speed).
DASH_WIDTH
Width, before the zoom multiplier, of the ribbon Animation::dash paints.
FLASH_DECAY_DURATION
How long Animation::flash_decay takes to fade back out, in seconds.
GLOW_BAND_LENGTH_PX
Length, in screen pixels, of the visible glow band Animation::glow_band paints. Deliberately not scaled by zoom, same reasoning as DASH_PERIOD_PX.
GLOW_BAND_PERIOD
How long one full traverse-and-loop of Animation::glow_band takes, 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 zoom multiplier, of the ribbon Animation::glow_band paints.
PULSE_DURATION
How long Animation::pulse plays, in seconds.
RIPPLE_DURATION
How long Animation::ripple plays, in seconds.
SCALE_IN_DURATION
How long Animation::scale_in plays, in seconds.
WIPE_DURATION
How long Animation::wipe takes to draw the line in, in seconds.