#tui #terminal #animation #effect #graphics

aisling

Embeddable terminal text effects and loaders for Rust TUI applications

8 unstable releases (3 breaking)

0.4.1 Sep 29, 2026
0.4.0 Sep 29, 2026
0.3.17 Jun 17, 2026
0.2.1 Jun 14, 2026
0.1.0 Jun 14, 2026

#173 in Command-line interface

Download history 29/week @ 2026-08-09 11/week @ 2026-08-16 18/week @ 2026-08-23 12/week @ 2026-08-30 33/week @ 2026-09-06 13/week @ 2026-09-13 15/week @ 2026-09-20 14/week @ 2026-09-27 9/week @ 2026-10-04 5/week @ 2026-10-11 11/week @ 2026-10-18 12/week @ 2026-10-25 17/week @ 2026-11-01 18/week @ 2026-11-08 11/week @ 2026-11-15 15/week @ 2026-11-22

64 downloads per month
Used in 15 crates (7 directly)

MIT license

240KB
6K SLoC

Aisling

Embeddable terminal text effects and loader animations for Rust TUI applications.

Aisling renders animated text effects, spinners, and progress loaders as plain Rust data. It does not own your terminal, start an event loop, sleep, or print unless you run the included examples. Your app drives an iterator or requests an indexed effect or loader frame and maps each styled Frame into Ratatui, Crossterm, ANSI output, tests, logs, or any custom renderer.

The effect catalog includes embeddable terminal text animations plus loader/status animations for TUI applications.

Install

cargo add aisling

Or in Cargo.toml:

[dependencies]
aisling = "0.4.1"

For local development from this repository:

[dependencies]
aisling = { path = "../aisling" }

Quick Start

use aisling::{Effect, EffectConfig, EffectKind};

let config = EffectConfig::default()
    .with_duration(80)
    .with_seed(42);

let effect = Effect::with_config(EffectKind::Matrix, "Aisling", config);

for frame in effect.iter() {
    // Map frame.cells() into your TUI buffer.
    let plain = frame.to_plain_string();
    let ansi = frame.to_ansi_string();
}

Progress loaders are also frame-based:

use aisling::{Loader, LoaderConfig, LoaderKind, LoaderProgress};

let loader = Loader::with_config(
    LoaderKind::Tqdm,
    LoaderConfig::default()
        .with_width(64)
        .with_label("download")
        .with_unit("B")
        .with_fraction(true),
);

let downloaded = 42;
let total = 100;
let frame = loader.frame(7, LoaderProgress::from_counts(downloaded, total));
let line = loader.line(7, LoaderProgress::from_counts(downloaded, total));

TUI Integration

Effect::iter() yields Frame values. A Frame is a fixed-size grid with row-major Cell data.

Important types:

Type Purpose
Effect Owns the effect kind, input text, and config.
EffectKind Selects one of the built-in effects.
EffectConfig Controls duration, seed, gradient, canvas size, color handling, and more.
EffectRenderer Retains a prepared effect plan; renders any frame index on demand.
EffectFrames Lazy forward iterator with exact length and efficient skipping via nth.
Loader Owns a loader kind and config; render with the current tick and progress.
LoaderKind Selects a built-in spinner/progress/download animation.
LoaderConfig Controls loader width, height, label, units, colors, and duration.
LoaderProgress Carries a progress fraction or current/total counters.
Frame Rendered 2D grid for a single animation tick.
Cell Character plus foreground/background colors and simple styles.
Color, Gradient, Easing Color and timing helpers.

Minimal renderer loop shape:

use aisling::{Effect, EffectKind};

let effect = Effect::new(EffectKind::Wipe, "ship it");

for frame in effect.iter() {
    for y in 0..frame.height() {
        for x in 0..frame.width() {
            let cell = frame.cell(x, y).unwrap();
            // Write cell.ch and cell.colors into your TUI buffer here.
        }
    }
}

For retained playback, loops, or dropped UI frames, compile once and request the frame your application needs:

use aisling::{Effect, EffectKind};

let renderer = Effect::new(EffectKind::Constellation, "Ready").compile();

// Keep `renderer` in your app state; your own clock supplies the animation tick.
let tick = 137;
let index = tick % renderer.frame_count();
let frame = renderer.frame(index).unwrap();

// Direct seeks and reverse playback use the same prepared plan.
let earlier_frame = renderer.frame(12).unwrap();
let settled_text = renderer.final_frame();

EffectRenderer owns a snapshot of the input and configuration. Recompile when the text, theme, canvas, or other settings change. It retains no rendered frames: each frame(index) call renders one owned Frame, and out-of-range indices return None. width() and height() expose the actual canvas dimensions without rendering. The final animation frame and all hold_final_frames match final_frame(); a zero duration acts as one, and the total count saturates at usize::MAX if adding holds would overflow.

Playback API Use when
effect.iter() You consume frames in order; nth(n) skips without rendering the skipped frames.
effect.compile() You retain playback state, seek, loop, or recover from skipped redraws with memory independent of duration.
effect.frames() You want every frame cached and can afford memory proportional to duration times canvas area.

Run cargo run --example indexed_playback -- constellation for a seven-second forward/reverse/seek demo, or add --plain for nine snapshots without delays or terminal escapes. Try hologram, origami, or any catalog name. See the indexed playback guide and measurements for cache integration and a reproducible memory/performance comparison.

Loaders

Loaders are for status lines, downloads, installs, background tasks, and tqdm-style progress indicators. Unlike text effects, real app progress usually comes from your own IO loop, so call Loader::frame(tick, progress) whenever your UI redraws.

use aisling::{Loader, LoaderKind, LoaderProgress};

let loader = Loader::new(LoaderKind::Download);
let tick = 12;
let frame = loader.frame(tick, LoaderProgress::from_counts(512, 1024));

Built-in loaders:

bar, tqdm, blocks, meter, battery, gauge, dots, pulse, line, bounce,
scanner, snake, pong, marquee, steps, download, upload, equalizer,
wave, matrix, spark, orbit, brackets, crawl, braided, burn, decrypt,
rain, thunderstorm, laseretch, vhstape, blackhole, fireworks, pour,
synthgrid, beams, smoke, binarypath, bouncyballs, bubbles, colorshift,
crumble, errorcorrect, expand, highlight, middleout, orbittingvolley,
overflow, print, randomsequence, rings, scattered, slice, slide,
spotlights, spray, swarm, sweep, unstable, waves, wipe, ember,
cipher, glitch, vortex, stormflicker, lasersweep, cascade, gridpulse

The effect-inspired loaders use the same Frame/Cell model but are designed for long-running tasks: burn smolders across the progress line, decrypt cascades cipher characters downward into the status, laseretch scans a hot beam, rings orbits around the transfer cursor, swarm throws particles around the active edge, thunderstorm layers rain with lightning, and the newer ember, cipher, glitch, vortex, stormflicker, lasersweep, cascade, and gridpulse variants provide denser full-panel status motion.

For quick plain-line output, use Loader::line(tick, progress). For TUI rendering, use Loader::frame(tick, progress) and map its cells into your buffer.

Effects

All 46 built-in effects are available through EffectKind and EffectKind::all().

Command Enum
beams EffectKind::Beams
binarypath EffectKind::BinaryPath
blackhole EffectKind::Blackhole
bouncyballs EffectKind::BouncyBalls
bubbles EffectKind::Bubbles
burn EffectKind::Burn
colorshift EffectKind::ColorShift
crumble EffectKind::Crumble
decrypt EffectKind::Decrypt
errorcorrect EffectKind::ErrorCorrect
expand EffectKind::Expand
fireworks EffectKind::Fireworks
highlight EffectKind::Highlight
laseretch EffectKind::LaserEtch
matrix EffectKind::Matrix
middleout EffectKind::MiddleOut
orbittingvolley EffectKind::OrbittingVolley
overflow EffectKind::Overflow
pour EffectKind::Pour
print EffectKind::Print
rain EffectKind::Rain
randomsequence EffectKind::RandomSequence
rings EffectKind::Rings
scattered EffectKind::Scattered
slice EffectKind::Slice
slide EffectKind::Slide
smoke EffectKind::Smoke
spotlights EffectKind::Spotlights
spray EffectKind::Spray
swarm EffectKind::Swarm
sweep EffectKind::Sweep
synthgrid EffectKind::SynthGrid
thunderstorm EffectKind::Thunderstorm
unstable EffectKind::Unstable
vhstape EffectKind::VhsTape
waves EffectKind::Waves
wipe EffectKind::Wipe
aurora EffectKind::Aurora
constellation EffectKind::Constellation
hologram EffectKind::Hologram
ripple EffectKind::Ripple
shatter EffectKind::Shatter
weave EffectKind::Weave
circuit EffectKind::Circuit
prism EffectKind::Prism
origami EffectKind::Origami

The nine newest effects add distinct kinds of motion:

Effect Animation
aurora Flowing light curtains sweep upward, leaving the text illuminated.
constellation Stars connect into a network, then send glowing particles into the text.
hologram A scanning projection resolves through flickering scanlines and offset ghost images.
ripple Concentric waves refract the letters before settling them into place.
shatter Rotating text fragments travel together and assemble into an intact surface.
weave Horizontal and vertical threads cross and stitch the letters into place.
circuit Pulses travel through branching circuit traces and power the letters into view.
prism Refracted text planes converge through a moving band of light.
origami Hinged strips unfold like an accordion into the final text.

These effects use the configured gradient, seed, easing, canvas, and ANSI color policy. They finish on the same styled text as Effect::final_frame() and support hold_final_frames and no_color. A canvas with several rows gives the curtains, stars, ripples, and fragments room to move; single-line input works too. Like the rest of the library, they add no dependencies, terminal ownership, or timing loop.

use aisling::{Effect, EffectConfig, EffectKind};

let effect = Effect::with_config(
    EffectKind::Constellation,
    "Signal becomes motion",
    EffectConfig::default()
        .with_duration(120)
        .with_seed(42)
        .with_canvas_size(48, 8),
);

for frame in effect.iter() {
    // Render the frame with your existing TUI adapter.
}

String parsing is supported:

use std::str::FromStr;
use aisling::EffectKind;

let kind = EffectKind::from_str("laseretch").unwrap();
assert_eq!(kind, EffectKind::LaserEtch);

Configuration

use aisling::{Color, EffectConfig, Easing, Gradient, GradientDirection};

let config = EffectConfig::default()
    .with_duration(120)
    .with_seed(9001)
    .with_canvas_size(48, 8)
    .with_gradient(
        Gradient::new(
            vec![Color::rgb(255, 170, 60), Color::rgb(80, 110, 95)],
            24,
        ),
        GradientDirection::Horizontal,
    );

Notable EffectConfig fields:

Field Meaning
duration Number of animation frames, including the settled last frame; zero acts as one.
hold_final_frames Extra frames that hold the final text; the total count saturates at usize::MAX.
seed Deterministic random seed for repeatable playback.
gradient Final/effect color gradient.
gradient_direction Horizontal, vertical, diagonal, or radial mapping.
easing Global easing used by many effect renderers.
existing_color_handling Preserve or ignore parsed ANSI input colors.
no_color Disable color output.
canvas_width, canvas_height Optional fixed frame dimensions.
tab_width Spaces per tab when parsing input text.

ANSI Input

Aisling parses common ANSI SGR sequences in input text, including foreground/background 3-bit, bright 3-bit, 8-bit xterm, and 24-bit RGB colors. Parsed styling is kept in each final Cell when the color-handling mode allows it.

use aisling::{Effect, EffectKind};

let effect = Effect::new(EffectKind::Print, "\x1b[38;2;255;80;80mred text\x1b[0m");
let final_frame = effect.final_frame();
assert_eq!(final_frame.to_plain_string(), "red text");

Examples

Run a single effect in the terminal:

cargo run --example demo -- wipe "Hello from Aisling"
cargo run --example demo -- matrix "opencode style"
cargo run --example indexed_playback -- constellation
cargo run --example indexed_playback -- hologram --plain
cargo run --example loaders -- tqdm --label download
cargo run --example loaders -- all --seconds 20 --fps 6
cargo run --example loader_lab -- --seconds 120
cargo run --example new_loaders -- --seconds 24 --fps 10
cargo run --example story -- --seconds 90 --fps 12

Use the helper script while developing locally:

./run.sh wipe "Hello from Aisling"
./run.sh matrix "opencode style"
./run.sh aurora "Signal becomes motion"
./run.sh new-effects --seconds 45
./run.sh indexed-playback origami
./run.sh list
./run.sh all "Aisling"
./run.sh loader tqdm --label download
./run.sh loaders --seconds 20 --fps 6
./run.sh new-loaders --seconds 24
./run.sh list-loaders
./loaders.sh
./loaders.sh --seconds 120 --focus-seconds 8
./story.sh
./story.sh --seconds 90 --fps 12
./text_effects.sh

Run the multi-pane all-effects showcase:

./run.sh showcase
./run.sh showcase --rainbow
./run.sh showcase --theme industrial
./run.sh showcase --seconds 60
./run.sh showcase --forever
./run.sh showcase --effects aurora,ripple,weave --seconds 30

The showcase defaults to a curated high-contrast palette and a masonry pane layout. Wider/taller effects such as matrix, blackhole, rain, thunderstorm, and vhstape receive larger panes when the terminal has room. Use --rainbow for the original full-spectrum theme or --industrial for a steel/amber palette.

./run.sh new-effects previews the nine new text effects using the same showcase. It accepts showcase options such as --text, --seconds, --page-seconds, and --rainbow. Use --effects with comma-separated effect names to choose any subset of the catalog. Allow at least 45 seconds on a small terminal to see every pane.

test.sh launches the showcase with a longer embedded text sample:

./test.sh
./test.sh 90
./test.sh --rainbow
./test.sh --industrial
./test.sh --industrial 90
./test.sh -loaders

./run.sh loaders and ./test.sh -loaders show the full loader catalog in a grid so the loader styles can be compared at once. The test.sh -loaders path defaults to slower playback.

loaders.sh runs the full loader command deck. It keeps every loader visible in a catalog strip, gives one loader a large story-style focus pane, keeps six surrounding live mock transfer lanes running at different speeds, and supports arrow-key focus changes in a real terminal.

story.sh runs a full TUI-style Knott Dynamics narrative demo. It uses the embedded text from test.sh, then composes matrix, burn, thunderstorm, laser etch, rings, swarm, fireworks, fake downloads, and exotic loaders into one animated dashboard.

text_effects.sh reuses the demo effect example and runs the full text effect catalog at full terminal size, using the Knott Dynamics story text by default.

Preview Videos

Nine animated terminal effects

Watch the 8-second comparison, the 72-second showreel, or the individual clips. Open docs/previews/index.html locally for a gallery with video controls.

The videos render actual Frame/Cell output at 24 fps, with six seconds of animation and two seconds holding the final text. Regenerate them from a repository checkout:

./video_previews.sh
AISLING_VIDEO_OUTPUT=/tmp/aisling-prism ./video_previews.sh --effects prism
AISLING_VIDEO_OUTPUT=/tmp/aisling-monochrome ./video_previews.sh --no-color

Video export requires Python 3, Pycairo, PyGObject with Pango/PangoCairo, FFmpeg with the libx264 encoder, and a monospace font. These are optional development tools; the Rust crate still has no dependencies. MP4 files use H.264 with yuv420p and fast-start metadata for broad player support. The recordings stay in the Git repository and are excluded from the Cargo package.

Release Notes

Version 0.4.1 adds reusable indexed playback through Effect::compile() and EffectRenderer, plus exact-length iterators with efficient frame skipping. Existing 0.4.0 animation output is preserved. The new terminal example demonstrates seeking and reverse playback; the recorded effect previews above remain current.

Version 0.4.0 adds nine EffectKind variants. Downstream code with exhaustive matches must handle the new variants; applications using EffectKind::all() discover them automatically. Existing effect IDs and seeded playback are preserved. See CHANGELOG.md for the complete release notes.

Package Verification

Before publishing:

cargo fmt
cargo test
cargo package --allow-dirty

Publish when ready:

cargo publish

License

MIT

No runtime deps