Skip to main content

Crate tui_splitflap

Crate tui_splitflap 

Source
Expand description

A Ratatui widget for retro split-flap display boards.

Animated character tiles flip through an ordered character set, recreating the mechanical departure boards found at airports and train stations.

§Quick start

use tui_splitflap::{FlapBoardState, FlapMessage};

let mut state = FlapBoardState::new(1, 20);
state.set_message(&FlapMessage::single("HELLO WORLD"));

// Advance by elapsed milliseconds each frame; returns true while animating.
let still_animating = state.tick(16);

Render by passing FlapBoard (a ratatui::widgets::StatefulWidget) and &mut state to frame.render_stateful_widget in your draw callback.

§Animation styles

Configured via FlapBoardState::with_flip_style:

StyleDescription
FlipStyle::SequentialCycles every intermediate character; duration scales with distance
FlipStyle::MechanicalSplit-block animation; constant duration regardless of distance
FlipStyle::CombinedMechanical phase, then sequential roll to the target character

Structs§

CharSet
Ordered sequence of characters a split-flap tile can display.
FlapBoard
Stateless widget that renders a split-flap board from FlapBoardState.
FlapBoardState
Owns all per-cell animation state for a split-flap board. Driven externally via tick() and set_message().
FlapCell
Per-cell animation state for a single split-flap tile.
FlapMessage
A message to display on the board, with optional per-message overrides.
FlapTheme
Color configuration for the split-flap board.

Enums§

CellWidth
Terminal columns per tile.
CharSetError
FlipPhase
What a cell is currently doing — determines how the widget renders it.
FlipStyle
Animation behavior for a cell flip.

Type Aliases§

Result
Convenience alias for results that fail with CharSetError.