#processing #sandbox #drawing

peach

Sandbox engine for Rust, inspired by Processing

2 unstable releases

✓ Uses Rust 2018 edition

0.3.0 Dec 21, 2019
0.2.0 Jun 6, 2019
0.1.3 Nov 7, 2018
0.1.2 Oct 21, 2018

#30 in Visualization

47 downloads per month

MIT and MPL-2.0 licenses

52KB
1K SLoC

Ruby 1K SLoC // 0.2% comments GDScript 17 SLoC

Peach

Processing-esque sandboxing library for Rust with wgpu.

Example

See the examples folder for more code snippets, as well as screen shots.

use peach::prelude::*;

fn main() {
    peach::run(
        draw,
        Config::default()
            .with_setup(setup)
            .with_exit_key(Key::Escape),
    );
}

fn setup(sketch: &mut Sketch) {
    sketch.fill(Color::RED);
    sketch.no_stroke();

    sketch.anchor(Anchor::Center);
}

fn draw(sketch: &mut Sketch, state: &State) {
    sketch.background(Color::WHITE);

    sketch.translate(state.cursor);
    sketch.rotate(state.frame as f32 / 100.0);
    sketch.rect(Point::zero(), Size::new(100.0, 100.0));
}

Dependencies

~29MB
~628K SLoC