RavenRS · Rust GUI

Minimap

Edit and run the Minimap 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 minimap() -> impl View {
    let view = State::new(ZoomView::at(1.0));
    let picture = |frame: ZoomPanPaint, scene: &mut Scene| {
        // ravenrs-lint: allow(raw_color) the stand-in photograph the minimap shows: its colors are the content
        scene.push_quad(Quad::new(frame.placed, Color::rgb(0.2, 0.45, 0.7)));
        let sun = Rect::new(
            frame.placed.x() + frame.placed.width() * 0.6,
            frame.placed.y() + frame.placed.height() * 0.2,
            80.0 * frame.scale,
            80.0 * frame.scale,
        );
        // ravenrs-lint: allow(raw_color) the stand-in photograph the minimap shows: its colors are the content
        scene.push_quad(Quad::new(sun, Color::rgb(0.95, 0.8, 0.3)).radius(40.0 * frame.scale));
    };
    let content = Size::new(800.0, 500.0);
    HStack::new((
        Minimap::custom(view.binding(), content, picture),
        ZoomPanView::custom(view.binding(), content, picture).size(240.0, 150.0),
    ))
    .spacing(12.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