Spinner

class Spinner(frames: List<Widget>, duration: Int = 1, initial: Int = 0) : Widget

A widget that will loop through a fixed list of frames.

The widget will render the same frame until tick is set or advanceTick is called, at which point the next frame will render. The animation will loop when tick is larger than the number frames.

To reduce the speed of the animation, increase the duration.

Parameters

initial

the starting tick value.

Constructors

Link copied to clipboard
constructor(frames: String, style: TextStyle = DEFAULT_STYLE, duration: Int = 1, initial: Int = 0)

Construct a Spinner from a string, where each character in the string is one frame.

constructor(frames: List<Widget>, duration: Int = 1, initial: Int = 0)

Types

Link copied to clipboard
object Companion

Properties

Link copied to clipboard

The current frame

Link copied to clipboard
var tick: Int

The current frame number.

Functions

Link copied to clipboard

Increment the tick value by one and return the new value.

Link copied to clipboard
open override fun measure(t: Terminal, width: Int): WidthRange
Link copied to clipboard
open override fun render(t: Terminal, width: Int): Lines
Link copied to clipboard
fun Widget.withPadding(padding: Padding, padEmptyLines: Boolean = true): Widget

Add padding around this widget.

fun Widget.withPadding(padEmptyLines: Boolean = true, padding: Padding.Builder.() -> Unit): Widget
fun Widget.withPadding(all: Int, padEmptyLines: Boolean = true): Widget
fun Widget.withPadding(top: Int, right: Int, bottom: Int, left: Int, padEmptyLines: Boolean = true): Widget