Skip to content

feat(tui-components): add animated backgrounds and motion storybook - #629

Draft
CSRessel wants to merge 4 commits into
mainfrom
feat/tui-animated-backgrounds
Draft

feat(tui-components): add animated backgrounds and motion storybook#629
CSRessel wants to merge 4 commits into
mainfrom
feat/tui-animated-backgrounds

Conversation

@CSRessel

Copy link
Copy Markdown
Collaborator

Adds a reusable Ratatui MotionBackground widget for onboarding and other full-screen experiences. Applications render it first, then place existing forms or menus over its optional quiet area. The caller owns the terminal, input, redraw cadence, animation time, and transition progress; MotionState provides an optional transition controller. The widget also supports palettes, ASCII, reduced motion, and clipped viewports.

The motion_storybook example loops between dots and braille formations, with platoon and muster variants and no UI overlays. --at-ms N pauses at an exact story time for reproducible review. Snapshot coverage includes 16 buffer fixtures and 10 paired text/ANSI terminal captures covering endpoints, inward and outward zoom, and narrow viewports. Fixed times include ambient motion as well as zoom progress.

Frame-local geometry caches, prepared style ramps, skipped hidden fields, and buffered terminal writes reduce measured headless p95 frame work by 21–26% while preserving 1,160 sampled glyph/style fingerprints. Ratatui continues to perform incremental terminal diffs. Large live PTY viewports still miss some 25 FPS deadlines; these measurements do not establish graphical terminal presentation FPS. Reproduction scripts, raw data, and limitations are in the performance report.

Validation:

  • Built all component examples with Rust 1.90.
  • cargo test -p nori-tui-components -- --include-ignored --test-threads=1: 127 tests passed, including the isolated tmux storybook tests and doctest; snapshot updates disabled for the verification run.
  • Reviewed and accepted the new snapshots; all 10 terminal text grids match their corresponding deterministic buffer fixtures, with RGB styling retained in ANSI captures.
  • just fix -p nori-tui-components and just fmt passed.
  • Final rebuilt example smoke check verified the exact paused muster return frame, s seeking to the inward frame, clean exit, and terminal mode restoration.

Try from nori-rs/:

cargo run --release -p nori-tui-components --example motion_storybook
cargo run --release -p nori-tui-components --example motion_storybook -- --muster
cargo run --release -p nori-tui-components --example motion_storybook -- --muster --at-ms 3600

Accept explicit scene, time, and transition progress; retain MotionState as an optional controller returning owned frames. Split palette, sampling, zoom, tile geometry, and state boundaries. Preserve existing visual snapshots and document the API migration and retained profiling evidence.
Prepare styles and bounded per-frame geometry caches, skip invisible fields, and buffer the existing Ratatui incremental output. Preserve sampled glyph/style output. Save baseline, interleaved release measurements, live terminal traces, syscall counts, and reproduction tools.
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

1 participant