RavenRS · Rust GUI

MoviePlayer

Edit and run the MoviePlayer 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 movie_player() -> impl View {
    use ravenrs::core::Primitive;
    use ravenrs::movie::{FilmBuilder, MoviePlayer};
    // Real films come from `Recorder`, which runs the app from a script.
    // ravenrs-lint: allow(raw_color) the film is a recording, and its white page is part of the picture
    let mut film = FilmBuilder::new(Size::new(320.0, 200.0), Color::WHITE);
    for second in 0..=6_u64 {
        let square =
            // ravenrs-lint: allow(raw_color) the square is drawn into the film, not into the interface
            Quad::new(Rect::new(20.0 + second as f32 * 40.0, 80.0, 40.0, 40.0), Color::hex(0x4f46e5));
        film.frame(second * 1000, &[Primitive::Quad(square.radius(8.0))]);
    }
    film.chapter("A square", "It goes across the screen.", 0);
    film.finish(6000).map(|film| MoviePlayer::new(film).width(640.0)).ok()
}

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