CodingTrain / Suggestion-Box

A repo to track ideas for topics
571 stars 86 forks source link

Try out Rust (Programming Language) and Nannou (creative coding framework) #1528

Open maan2003 opened 4 years ago

maan2003 commented 4 years ago

By try out, I mean a single stream. Nannou is inspired from processing. They have ported the Nature of Code examples to Rust. Pick an example and start tweaking.

Also check out the Nannou guide

ritobanrc commented 4 years ago

Rust is great, but I'd suggest instead of Nannou to use a windowing library (something like winit, minifb, or pixels) with a separate drawing library (something like wgpu-rs, raqote, cairo (w/ gtk-rs, vgtk, or relm), or even just svg).

Another possibility is to use a larger framework like coffee or piston (though piston isn't particularly well maintained anymore). I just found nannou to be really awkward and kinda slow and clunky to use. I suppose all of my suggestions require more boilerplate to get set up than nannou, but I think once its set up, it might be a bit more ergonomic to use. That's mostly just personal preference though.

I should also link the official Rust Book, the canonical way of learning Rust. Even just going through the book on stream might be interesting. Rustlings is a really great way to learn Rust through examples. Additionally, all of the libraries I mentioned can be found on crates.io, the official place to find all Rust libraries, with lovely auto-generated documentation available at docs.rs.

Edit: A couple days ago, I started using Druid, and I think Druid (with its drawing library, Piet) might be the best drawing library I've used so far. There's barely any boilerplate required (at least, compared to winit or minifb or pixels) -- you just need to create a Canvas struct and impl Widget on it. The API is almost as clean as p5.js or Processing.

maan2003 commented 4 years ago

Going through the book will be so satisfying. Yes nannou is indeed slow and clunky. But for a beginner in Rust, it presents much easier API. Somewhat similar to p5.js