Crates.io | terani |
lib.rs | terani |
version | 0.1.0 |
source | src |
created_at | 2024-06-01 06:08:05.104622 |
updated_at | 2024-06-01 06:08:05.104622 |
description | A Terminal Animator Engine In Rust. |
homepage | |
repository | https://github.com/Smallsan/terani |
max_upload_size | |
id | 1258520 |
size | 26,316 |
This is a terminal animator engine written in Rust. It provides several text effects that can be used to animate text in the terminal.
Scattering: This effect makes the text appear as if it's scattering across the terminal. Implemented in scattering.rs
.
Typewriter: This effect makes the text appear as if it's being typed out in real-time. Implemented in typewriter.rs
.
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
.
Blinking: This effect makes the text blink in the terminal. Implemented in blinking.rs
.
Color Changing: This effect changes the color of the text in the terminal. Implemented in color_changing.rs
.
Climbing: This effect makes the text appear as if it's climbing up the terminal. Implemented in climbing.rs
.
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.
To use the terminal animator engine, create an Animation
with a sequence of Frame
s, 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;
}
}