Skip to main content

rings/
rings.rs

1use terminal_graphics_interactive::prelude::*;
2
3fn main() -> std::io::Result<()> {
4    // Rainbow rings that follow the mouse. Hold the button to mix in waves.
5    sketch_with(Palette::rainbow(), |cell| {
6        let rings = (cell.dist_to_mouse() * 0.35 - cell.t * 2.0).sin();
7        let waves = (cell.x * 0.1 + cell.y * 0.1 + cell.t).sin();
8        if cell.mouse_down {
9            rings * waves
10        } else {
11            (rings + waves) / 2.0
12        }
13    })
14}