Home

Awesome

tachyonfx

Crate Badge API Badge Deps.rs
Badge

tachyonfx is a ratatui library for creating shader-like effects in terminal UIs. This library provides a collection of effects that can be used to enhance the visual appeal of terminal applications, offering capabilities such as color transformations, animations, and complex effect combinations.

demo

Installation

Add tachyonfx to your Cargo.toml:

tachyonfx = "0.7.0"

Features

Overview

Effects

The library includes a variety of effects, loosely categorized as follows:

Color Effects

Text/Character Effects

Timing and Control Effects

Geometry Effects

Combination Effects

Other Effects

EffectTimer and Interpolations

The EffectTimer is used to control the duration and interpolation of effects. It allows for precise timing and synchronization of visual effects within your application.

Cell Selection and Area

Effects can be applied to specific cells in the terminal UI, allowing for targeted visual modifications and animations.

// only apply to cells with `Light2` foreground color
fx::sweep_in(Direction::UpToDown, 15, 0, Dark0, timer)
    .with_cell_selection(CellFilter::FgColor(Light2.into()))

CellFilters can be combined to form complex selection criteria.

// apply effect to cells on the outer border of the area
let margin = Margin::new(1, 1);
let border_text = CellFilter::AllOf(&[
    CellFilter::Outer(margin),
    CellFilter::Text
]);

prolong_start(duration, fx::fade_from(Dark0, Dark0, (320, QuadOut)),
    .with_cell_selection(border_text)

Examples

Example: tweens

tweens

cargo run --release --example=tweens 

Example: basic-effects

basic effeects

cargo run --release --example=basic-effects 

Example: open-window

cargo run --release --example=open-window  

Example: fx-chart

fx-chart

A demo of the EffectTimelineWidget showcasing the composition of effects. The widget is a "plain" widget without any effects as part of its rendering. The effects are instead applied after rendering the widget.

cargo run --release --example=fx-chart