RavenRS · Rust GUI

QuadField

Edit and run the QuadField 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 quad_field() -> impl View {
    // Scroll inside: the waving floor stands up into a small dashboard.
    // ravenrs-lint: allow(raw_color) the pixels of the scene, like those of an `ImageData::from_fn`
    let (floor, bars, ground) = (Color::hex(0x222734), Color::hex(0x4c66ee), Color::hex(0x12151c));
    let picture = move |u: f32, v: f32, time: f64| {
        let bar = ((u - 0.1) / 0.1).floor();
        let height = 0.35 + 0.25 * (bar * 1.7 + time as f32).sin().abs();
        if v < 0.15 {
            floor
        } else if (0.1..0.9).contains(&u) && v > 0.9 - height {
            bars
        } else {
            ground
        }
    };
    ScrollView::new((
        ScrollScene::new(QuadField::new(64, 36, picture).height(280.0)).length(600.0),
        Canvas::new(|_, _| {}).size(10.0, 400.0),
    ))
    .spacing(0.0)
    .height(280.0)
}

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