Skip to content

Commit cf56e93

Browse files
committed
chore: more tape cleanup
1 parent 155df3b commit cf56e93

File tree

4 files changed

+18
-10
lines changed

4 files changed

+18
-10
lines changed

README.md

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -11,6 +11,8 @@
1111
1212
## Examples
1313

14+
![Example](https://github.com/pemattern/tui-shader/blob/main/assets/pipe-into.gif)
15+
1416
For the sake of simplicity, all examples run for a few seconds, and then quit.
1517
To run examples use the following command:
1618

assets/pipe-into.gif

90.2 KB
Loading

examples/pipe-into/main.rs

Lines changed: 10 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -1,3 +1,5 @@
1+
use tui_shader::ShaderCanvasOptions;
2+
13
pub fn main() -> std::io::Result<()> {
24
let mut s = String::new();
35
{
@@ -6,17 +8,20 @@ pub fn main() -> std::io::Result<()> {
68
}
79

810
let mut terminal = ratatui::init();
9-
let mut state = tui_shader::ShaderCanvasState::new("shaders/gradient.wgsl");
11+
let mut state = tui_shader::ShaderCanvasState::new_with_options(
12+
"shaders/gradient.wgsl",
13+
ShaderCanvasOptions {
14+
style_rule: tui_shader::StyleRule::ColorFg,
15+
..Default::default()
16+
},
17+
);
1018

1119
let start_time = std::time::Instant::now();
12-
loop {
20+
while start_time.elapsed().as_secs() < 7 {
1321
terminal.draw(|frame| {
1422
frame.render_stateful_widget(tui_shader::ShaderCanvas, frame.area(), &mut state);
1523
frame.render_widget(ratatui::widgets::Paragraph::new(s.as_str()), frame.area());
1624
})?;
17-
if start_time.elapsed().as_secs() > 5 {
18-
break;
19-
}
2025
std::thread::sleep(std::time::Duration::from_millis(10));
2126
}
2227
ratatui::restore();

examples/pipe-into/pipe-into.tape

Lines changed: 6 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -1,10 +1,11 @@
1-
Output "assets/stylize-other-widget.gif"
1+
Output "assets/pipe-into.gif"
22
Set FontFamily "JetBrainsMonoNL NF"
3-
Set Width 400
3+
Set Width 880
44
Set Height 200
5+
Type@50ms `echo "fancy..." | cargo run --example=pipe-into`
6+
Sleep 1s
57
Hide
6-
Type "cargo run --example=stylize-other-widget"
78
Enter
8-
Sleep 2s
9+
Sleep 1s
910
Show
10-
Sleep 6.4s
11+
Sleep 5s

0 commit comments

Comments
 (0)