Skip to main content

Module spinner

Module spinner 

Source
Available on crate feature spinner only.
Expand description

An indeterminate loading spinner.

The spinner has no clock of its own. The app keeps a phase in its state, advances it with advance on each frame while loading (for example from iced::window::frames()), and stops subscribing when it is done.

The track and the arc are small SVG images drawn through iced’s image path, which behaves the same on every backend. The arc comes from a fixed set of FRAMES pre-rotated images, so spinners at the same phase share one cached image.

Structs§

Colours
Colours of the track and the moving arc.
Spinner
A spinner builder. Convert it into an Element to render.

Enums§

Size
Spinner diameter.

Constants§

ARC
Share of the circle covered by the moving arc.
FRAMES
Number of distinct arc positions in one turn.
PERIOD
Time for one full turn.

Functions§

advance
Advances phase by the share of PERIOD that elapsed covers.
arc_angles
Start and end angles of the moving arc, clockwise from the top.
arc_svg
SVG markup for the arc at phase, running clockwise over ARC of the circle from the angle arc_angles gives.
colours
Resolves the spinner colours.
frame
The arc image drawn for phase: the nearest of the FRAMES positions.
spinner
Creates a spinner at phase, measured in turns (0.0 to 1.0).
track_svg
SVG markup for the full circle behind the arc.
wrap
Wraps a phase into 0.0..1.0. Non-finite phases become 0.0.