Smallsan / terani

A Terminal Animator Engine In Rust.

Home Page:https://crates.io/crates/terani

Geek Repo:Geek Repo

Github PK Tool:Github PK Tool

Terminal Animator Engine In Rust

This is a terminal animator engine written in Rust. It provides several text effects that can be used to animate text in the terminal.

Features

Text Effects

  1. Scattering: This effect makes the text appear as if it's scattering across the terminal. Implemented in scattering.rs.

  2. Typewriter: This effect makes the text appear as if it's being typed out in real-time. Implemented in typewriter.rs.

  3. Scrolling: This effect makes the text appear as if it's scrolling across the terminal. There are two variants of this effect: ScrollingLeft and ScrollingRight. Implemented in scrolling.rs.

  4. Blinking: This effect makes the text blink in the terminal. Implemented in blinking.rs.

  5. Color Changing: This effect changes the color of the text in the terminal. Implemented in color_changing.rs.

  6. Climbing: This effect makes the text appear as if it's climbing up the terminal. Implemented in climbing.rs.

Animation

The Animation struct is used to create an animation from a sequence of frames. Each frame consists of a string of text and a text effect. The animation plays each frame in sequence, applying the text effect to the text before displaying it in the terminal.

Usage

To use the terminal animator engine, create an Animation with a sequence of Frames, then call animation.next_frame() in a loop. Here is an example:

let frames = vec![
    Frame::new("I am in love with you please marry me!", Climbing),
    Frame::new("Alice alice alice alice alice alice", Climbing),
    Frame::new("I want to be with you forever!", Climbing),
];
let mut animation = Animation::new(frames, Duration::from_millis(100));
loop {
    if let Err(e) = animation.next_frame() {
        eprintln!("Error displaying frame: {}", e);
        break;
    }
}

About

A Terminal Animator Engine In Rust.

https://crates.io/crates/terani


Languages

Language:Rust 100.0%