RavenRS · Rust GUI

TransformHandles

Edit and run the TransformHandles 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 transform_handles() -> impl View {
    let layer = State::new(BoxTransform::new(Rect::new(110.0, 70.0, 180.0, 100.0)).rotated(-8.0));
    let shown = layer.clone();
    let picture = Canvas::new(move |frame, scene| {
        let p = shown.get();
        let at = p.rect.translate(frame.origin);
        // ravenrs-lint: allow(raw_color) the stand-in canvas behind the layer being transformed
        scene.push_quad(Quad::new(frame, Color::rgb(0.2, 0.27, 0.35)));
        // ravenrs-lint: allow(raw_color) the layer being transformed, as the user painted it
        scene.push_quad(Quad::new(at, Color::rgb(0.3, 0.55, 0.75).with_alpha(0.6)));
    })
    .size(420.0, 230.0);
    TransformHandles::new(layer.binding()).stage(picture)
}

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