Expand description
Character animations rendered as RGBA frames and displayed in a terminal.
SpriteAnimation supports frame sequences and regular RGBA sprite sheets.
Iterm2 preserves transparency in Konsole; Sixel provides solid-background
output for SIXEL-capable terminals. Kitty sends RGBA to terminals supporting
the Kitty graphics protocol.
Applications own the clock, playback loop and terminal layout.
TerminalProbe optionally queries capabilities when explicitly driven by
the host; animation and backend APIs never start a probe themselves.
use std::{io, time::Duration};
use anitty::{Animation, Backend, Sixel, SpriteAnimation};
let image = image::open("character.webp")?.into_rgba8();
let sheet = anitty::RgbaFrame::new(image.width(), image.height(), image.into_raw())?;
let mut animation = SpriteAnimation::from_sheet(
sheet, 64, 64, Duration::from_millis(100),
)?;
// A solid background paints over old frames. Use Iterm2 to preserve alpha;
// Konsole replaces same-sized images at the same position without clearing.
let mut backend = Sixel::new([0, 0, 0]);
let mut output = io::stdout().lock();
backend.draw(animation.render(Duration::ZERO, 64, 64)?, &mut output)?;
// Advance time and draw at the same position to replace the previous frame.
backend.draw(animation.render(Duration::from_millis(100), 64, 64)?, &mut output)?;Re-exports§
pub use animation::Animation;pub use animation::Bounds;pub use animation::PlaybackMode;pub use animation::RenderMapping;pub use animation::RenderOptions;pub use animation::SpriteAnimation;pub use animation::SpriteClip;pub use animation::Transform;pub use animation::SpineAnimation;pub use animation::SpineOptions;pub use backend::Backend;pub use backend::Iterm2;pub use backend::Kitty;pub use backend::Sixel;pub use terminal::Support;pub use terminal::TerminalCapabilities;pub use terminal::TerminalProbe;
Modules§
- animation
- Animation sources that render into a common RGBA frame.
- backend
- Terminal output consumes RGBA frames without knowing their animation source.
- terminal
- Optional terminal capability probing, independent of rendering and playback.
Structs§
- Rgba
Frame - A nonempty, tightly packed RGBA8 image.
Enums§
- Error
- Invalid input, image/terminal encoding failure, or output failure.