gleamtea/spinner

A bubble: an animated spinner.

Return tick from your init, then forward every message to update — the spinner recognises only its own tick messages and keeps itself running by returning the next tick.

Types

An opaque spinner value (a beamtea beamtea_spinner model).

pub type Spinner

A built-in spinner style.

pub type Style {
  Line
  Dot
  Minidot
  Jump
  Points
  Moon
  Meter
  Pulse
}

Constructors

  • Line
  • Dot
  • Minidot
  • Jump
  • Points
  • Moon
  • Meter
  • Pulse

Values

pub fn new() -> Spinner

A spinner with the default style (Dot).

pub fn styles() -> List(Style)

The list of built-in style names.

pub fn tick(spinner: Spinner) -> gleamtea.Cmd(msg)

The command that advances the animation once. Return it from init.

pub fn update(
  msg: msg,
  spinner: Spinner,
) -> #(Spinner, gleamtea.Cmd(msg))

Advance the spinner on its own tick; ignore everything else.

pub fn view(spinner: Spinner) -> String

The current frame, coloured if a colour was configured.

pub fn with_style(style: Style) -> Spinner

A spinner with the given built-in style.

Search Document