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
Elementto 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
phaseby the share ofPERIODthatelapsedcovers. - 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 overARCof the circle from the anglearc_anglesgives. - colours
- Resolves the spinner colours.
- frame
- The arc image drawn for
phase: the nearest of theFRAMESpositions. - 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.