diff --git a/examples/demo/Cargo.lock b/examples/demo/Cargo.lock index 0228934..4bc7017 100644 --- a/examples/demo/Cargo.lock +++ b/examples/demo/Cargo.lock @@ -63,6 +63,31 @@ version = "2.6.0" source = "registry+https://github.com/rust-lang/crates.io-index" checksum = "b048fb63fd8b5923fc5aa7b340d8e156aec7ec02f0c78fa8a6ddc2613f6f71de" +[[package]] +name = "bon" +version = "3.3.2" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "fe7acc34ff59877422326db7d6f2d845a582b16396b6b08194942bf34c6528ab" +dependencies = [ + "bon-macros", + "rustversion", +] + +[[package]] +name = "bon-macros" +version = "3.3.2" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "4159dd617a7fbc9be6a692fe69dc2954f8e6bb6bb5e4d7578467441390d77fd0" +dependencies = [ + "darling", + "ident_case", + "prettyplease", + "proc-macro2", + "quote", + "rustversion", + "syn", +] + [[package]] name = "bumpalo" version = "3.16.0" @@ -136,6 +161,12 @@ version = "1.0.3" source = "registry+https://github.com/rust-lang/crates.io-index" checksum = "5b63caa9aa9397e2d9480a9b13673856c78d8ac123288526c37d7839f2a86990" +[[package]] +name = "colorsys" +version = "0.6.7" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "54261aba646433cb567ec89844be4c4825ca92a4f8afba52fc4dd88436e31bbd" + [[package]] name = "compact_str" version = "0.8.1" @@ -202,6 +233,39 @@ dependencies = [ "clap", "rand", "ratzilla", + "tachyonfx", + "tui-big-text", +] + +[[package]] +name = "derive_builder" +version = "0.20.2" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "507dfb09ea8b7fa618fcf76e953f4f5e192547945816d5358edffe39f6f94947" +dependencies = [ + "derive_builder_macro", +] + +[[package]] +name = "derive_builder_core" +version = "0.20.2" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "2d5bcf7b024d6835cfb3d473887cd966994907effbe9227e8c8219824d06c4e8" +dependencies = [ + "darling", + "proc-macro2", + "quote", + "syn", +] + +[[package]] +name = "derive_builder_macro" +version = "0.20.2" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "ab63b0e2bf4d5928aff72e83a7dace85d7bba5fe12dcc3c5a572d78caffd3f3c" +dependencies = [ + "derive_builder_core", + "syn", ] [[package]] @@ -234,6 +298,12 @@ version = "0.1.4" source = "registry+https://github.com/rust-lang/crates.io-index" checksum = "a0d2fde1f7b3d48b8395d5f2de76c18a528bd6a9cdde438df747bfcba3e05d6f" +[[package]] +name = "font8x8" +version = "0.3.1" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "875488b8711a968268c7cf5d139578713097ca4635a76044e8fe8eedf831d07e" + [[package]] name = "hashbrown" version = "0.15.2" @@ -345,6 +415,16 @@ dependencies = [ "yansi", ] +[[package]] +name = "prettyplease" +version = "0.2.25" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "64d1ec885c64d0457d564db4ec299b2dae3f9c02808b8ad9c3a089c591b18033" +dependencies = [ + "proc-macro2", + "syn", +] + [[package]] name = "proc-macro2" version = "1.0.92" @@ -400,7 +480,7 @@ dependencies = [ [[package]] name = "ratzilla" -version = "0.0.0-alpha.5" +version = "0.0.0-alpha.6" dependencies = [ "console_error_panic_hook", "ratatui", @@ -420,6 +500,12 @@ version = "1.0.18" source = "registry+https://github.com/rust-lang/crates.io-index" checksum = "f3cb5ba0dc43242ce17de99c180e96db90b235b8a9fdc9543c96d2209116bd9f" +[[package]] +name = "simple-easing" +version = "1.0.1" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "832ddd7df0d98d6fd93b973c330b7c8e0742d5cb8f1afc7dea89dba4d2531aa1" + [[package]] name = "static_assertions" version = "1.1.0" @@ -465,6 +551,18 @@ dependencies = [ "unicode-ident", ] +[[package]] +name = "tachyonfx" +version = "0.10.1" +source = "git+https://github.com/orhun/tachyonfx?branch=feat%2Fwasm_support#89dc2ede9c7781468cf5cbc59157f8a9168d3cf9" +dependencies = [ + "bon", + "colorsys", + "ratatui", + "simple-easing", + "web-time", +] + [[package]] name = "thiserror" version = "2.0.11" @@ -485,6 +583,18 @@ dependencies = [ "syn", ] +[[package]] +name = "tui-big-text" +version = "0.7.0" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "8b046cf880cb40db75567b60ca22dc38a4165ef490be6bfad5718b22bcb6aabf" +dependencies = [ + "derive_builder", + "font8x8", + "itertools", + "ratatui", +] + [[package]] name = "unicode-ident" version = "1.0.14" @@ -590,6 +700,16 @@ dependencies = [ "wasm-bindgen", ] +[[package]] +name = "web-time" +version = "1.1.0" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "5a6580f308b1fad9207618087a65c04e7a10bc77e02c8e84e9b00dd4b12fa0bb" +dependencies = [ + "js-sys", + "wasm-bindgen", +] + [[package]] name = "windows-sys" version = "0.59.0" diff --git a/examples/demo/Cargo.toml b/examples/demo/Cargo.toml index ce2e093..657f0b8 100644 --- a/examples/demo/Cargo.toml +++ b/examples/demo/Cargo.toml @@ -8,3 +8,5 @@ publish = false clap = { version = "4.5.23", features = ["derive"] } rand = { version = "0.8.5", features = ["small_rng"], default-features = false } ratzilla = { path = "../../" } +tachyonfx = { git = "https://github.com/orhun/tachyonfx", branch = "feat/wasm_support", default-features = false, features = ["web-time"] } +tui-big-text = "0.7.0" diff --git a/examples/demo/src/app.rs b/examples/demo/src/app.rs index 30fb7ee..baea52b 100644 --- a/examples/demo/src/app.rs +++ b/examples/demo/src/app.rs @@ -1,9 +1,13 @@ -use rand::SeedableRng; use rand::{ distributions::{Distribution, Uniform}, rngs::SmallRng, + SeedableRng, +}; +use ratzilla::ratatui::{style::Color, widgets::ListState}; +use tachyonfx::{ + fx::{self}, + Effect, EffectTimer, Interpolation, Motion, }; -use ratzilla::ratatui::widgets::ListState; const TASKS: [&str; 24] = [ "Item1", "Item2", "Item3", "Item4", "Item5", "Item6", "Item7", "Item8", "Item9", "Item10", @@ -233,6 +237,7 @@ pub struct App<'a> { pub barchart: Vec<(&'a str, u64)>, pub servers: Vec<Server<'a>>, pub enhanced_graphics: bool, + pub effect: Effect, } impl<'a> App<'a> { @@ -297,6 +302,25 @@ impl<'a> App<'a> { }, ], enhanced_graphics, + effect: fx::sequence(&[ + fx::parallel(&[ + fx::sweep_in( + Motion::LeftToRight, + 10, + 0, + Color::Black, + EffectTimer::from_ms(7000, Interpolation::QuadIn), + ), + fx::sweep_in( + Motion::UpToDown, + 10, + 0, + Color::Black, + EffectTimer::from_ms(7000, Interpolation::QuadIn), + ), + ]), + fx::coalesce((2000, Interpolation::SineOut)), + ]), } } diff --git a/examples/demo/src/ui.rs b/examples/demo/src/ui.rs index fba1ad3..9ae164b 100644 --- a/examples/demo/src/ui.rs +++ b/examples/demo/src/ui.rs @@ -1,6 +1,6 @@ use ratzilla::ratatui::{ - layout::{Constraint, Layout, Rect}, - style::{Color, Modifier, Style}, + layout::{Constraint, Layout, Margin, Rect}, + style::{Color, Modifier, Style, Stylize}, symbols, text::{self, Span}, widgets::{ @@ -10,6 +10,8 @@ use ratzilla::ratatui::{ }, Frame, }; +use tachyonfx::{Duration, EffectRenderer}; +use tui_big_text::{BigText, PixelSize}; use crate::app::App; @@ -31,6 +33,18 @@ pub fn draw(frame: &mut Frame, app: &mut App) { 2 => draw_third_tab(frame, app, chunks[1]), _ => {} }; + let big_text = BigText::builder() + .pixel_size(PixelSize::Quadrant) + .lines(vec!["RATZILLA".white().into()]) + .build(); + frame.render_widget( + big_text, + frame.area().inner(Margin { + horizontal: frame.area().width / 2 - 15, + vertical: 0, + }), + ); + frame.render_effect(&mut app.effect, frame.area(), Duration::from_millis(40)); } fn draw_first_tab(frame: &mut Frame, app: &mut App, area: Rect) {