SpinnerStyle
Namespace: Hex1b.Widgets
Assembly: Hex1b.dll
Defines a spinner animation style as a sequence of frames.
public sealed class SpinnerStyleInheritance
Object → SpinnerStyle
Constructors
SpinnerStyle(params string[])
Creates a custom spinner style with default settings (80ms, no auto-reverse).
Parameters:
frames(String[]): The animation frames to cycle through.
public SpinnerStyle(params string[] frames)SpinnerStyle(TimeSpan, bool, params string[])
Creates a custom spinner style with the specified interval and auto-reverse setting.
Parameters:
interval(TimeSpan): Suggested time between frame changes.autoReverse(Boolean): Whether to ping-pong instead of loop.frames(String[]): The animation frames to cycle through.
public SpinnerStyle(TimeSpan interval, bool autoReverse, params string[] frames)SpinnerStyle(TimeSpan, params string[])
Creates a custom spinner style with the specified interval.
Parameters:
interval(TimeSpan): Suggested time between frame changes.frames(String[]): The animation frames to cycle through.
public SpinnerStyle(TimeSpan interval, params string[] frames)Properties
Arrow
Arrow rotation (loops)
Returns: SpinnerStyle
public static SpinnerStyle Arrow { get; }AutoReverse
Gets whether the animation should reverse (ping-pong) instead of looping.
Returns: Boolean
public bool AutoReverse { get; }Bounce
Bouncing bar (auto-reverses for smooth bounce)
Returns: SpinnerStyle
public static SpinnerStyle Bounce { get; }BouncingBall
Bouncing ball in brackets (loops)
Returns: SpinnerStyle
public static SpinnerStyle BouncingBall { get; }Circle
Quarter circle rotation (loops)
Returns: SpinnerStyle
public static SpinnerStyle Circle { get; }Dots
Braille dot pattern (loops)
Returns: SpinnerStyle
public static SpinnerStyle Dots { get; }DotsScrolling
Scrolling braille dots (loops)
Returns: SpinnerStyle
public static SpinnerStyle DotsScrolling { get; }Frames
Gets the animation frames for this spinner style.
Returns: IReadOnlyList<String>
public IReadOnlyList<string> Frames { get; }GrowHorizontal
Horizontal bar growth (auto-reverses)
Returns: SpinnerStyle
public static SpinnerStyle GrowHorizontal { get; }GrowVertical
Vertical bar growth (auto-reverses)
Returns: SpinnerStyle
public static SpinnerStyle GrowVertical { get; }Interval
Gets the suggested interval between frame changes for smooth animation.
Returns: TimeSpan
public TimeSpan Interval { get; }Line
Classic ASCII line spinner: | / - \ (loops)
Returns: SpinnerStyle
public static SpinnerStyle Line { get; }LoadingBar
Loading bar (loops)
Returns: SpinnerStyle
public static SpinnerStyle LoadingBar { get; }Segments
Segmented blocks (loops)
Returns: SpinnerStyle
public static SpinnerStyle Segments { get; }Square
Square corner rotation (loops)
Returns: SpinnerStyle
public static SpinnerStyle Square { get; }Methods
GetFrame(int)
Gets the frame at the given index, handling auto-reverse if enabled.
Parameters:
frameIndex(Int32): The frame index (any integer, wraps/bounces automatically).
Returns: String
The frame string at that index.
public string GetFrame(int frameIndex)Remarks
SpinnerStyle provides built-in styles via static properties (e.g., , ) and supports custom styles via the constructor.
Each style includes a suggested for smooth animation and an flag to control whether the animation ping-pongs or loops.
Examples
Using a built-in style:
ctx.Spinner(SpinnerStyle.Dots, frameIndex)Creating a custom style:
var moonPhases = new SpinnerStyle(
TimeSpan.FromMilliseconds(500),
"🌑", "🌒", "🌓", "🌔", "🌕", "🌖", "🌗", "🌘");
ctx.Spinner(moonPhases, frameIndex)