RavenRS · Rust GUI

CompareView

Edit and run the CompareView RavenRS example in your browser. Explore its Rust code and download a Cargo project for desktop and WebAssembly.

One declarative Rust interface, GPU rendering, reactive state and semantic design tokens. Free and open source under MIT OR Apache-2.0.

Rust source

fn compare_view() -> AnyView {
    let tone = |warm: f32| {
        ImageData::from_fn(240, 160, move |x, y| {
            let light = 0.25 + 0.5 * x as f32 / 240.0;
            Color::rgb(light + warm, light, light - warm + 0.2 * y as f32 / 160.0)
        })
    };
    match (tone(0.0), tone(0.2)) {
        (Some(before), Some(after)) => {
            Box::new(CompareView::new(before, after).mode(CompareMode::Divider).size(420.0, 200.0))
        }
        _ => Box::new(Text::new("No pictures")),
    }
}

The interactive preview loads when JavaScript and WebGPU or WebGL2 are available. You can read the guide and examples here at any time.

More examples