Skip to content

SpinnerNode

Namespace: Hex1b

Assembly: Hex1b.dll

Render node for displaying animated spinners. Created by reconciling a .

csharp
public sealed class SpinnerNode : Hex1bNode

Inheritance

ObjectHex1bNodeSpinnerNode

Properties

ExplicitFrameIndex

Gets or sets an explicit frame index for manual control. When null, the spinner uses time-based animation.

Returns: Nullable<Int32>

csharp
public int? ExplicitFrameIndex { get; set; }

Style

Gets or sets the explicit spinner style, or null to use theme default.

Returns: SpinnerStyle

csharp
public SpinnerStyle? Style { get; set; }

Methods

GetTimeUntilNextFrame()

Gets the time until the next frame transition for scheduling redraws.

Returns: TimeSpan

csharp
public TimeSpan GetTimeUntilNextFrame()

MeasureCore(Constraints)

Measures the size required for the spinner.

Parameters:

  • constraints (Constraints): The size constraints for layout.

Returns: Size

The measured size based on the current frame's display width.

csharp
protected override Size MeasureCore(Constraints constraints)

Render(Hex1bRenderContext)

Renders the spinner to the terminal.

Parameters:

csharp
public override void Render(Hex1bRenderContext context)

Remarks

SpinnerNode handles measuring and rendering spinner frames. The spinner style is resolved from the widget's explicit style or the theme's default.

Animation is time-based: the node tracks when it started and calculates the current frame based on elapsed time and the style's interval. This ensures consistent animation speed regardless of how often the screen is redrawn.

This node is not focusable and does not handle input. It is a display-only widget.

Released under the MIT License.