/nannou

A Creative Coding Framework for Rust

Primary LanguageRustMIT LicenseMIT

A Quick Note

This project is brand new and there is a lot of work to be done. Feel free to help out!

nannou Build Status Crates.io Crates.io docs.rs

An open-source creative-coding toolkit for Rust.

nannou is a collection of code aimed at making it easy for artists to express themselves with simple, fast, reliable, portable code. Whether working on a 12-month laser installation or a 5 minute sketch, this framework aims to give artists easy access to the tools they need.

The project was started out of a desire for a creative coding framework inspired by Processing, OpenFrameworks and Cinder, but for Rust. Named after this

Getting Started

See what the code looks like by checking out the examples. See the following section to learn how to run these examples.

If you're new to Rust, maybe check out the official book?

Start your own project with:

cargo new my_project
cd my_project

Add nannou = "0.5" under the [dependencies] line in your Cargo.toml. This is everything you need to use the framework in your own project or sketch. Rust's package manager cargo will automatically download and install everything you need!

Running Examples

Clone this git repo (which contains the examples) to your computer.

git clone https://github.com/nannou-org/nannou

Change the current directory to nannou.

cd nannou

Run the example using cargo.

cargo run --release --example simple_window

The --release flag means we want to build with optimisations enabled.

To run any of the other examples, replace simple_window with the name of the desired example.

Goals

  • Provide easy, cross-platform access to the things that artists need:
    • Windowing & Events (via winit and glutin)
    • Audio (via CPAL) Input and output streams. Duplex are not yet supported.
    • GUI (via conrod, may switch to a native solution in the future).
    • OSC (via rosc)
    • Graphics (via glium)
    • Video
    • Geometry
    • Lighting & Lasers (DMX, ILDA)
  • Use only pure-rust libraries. New users should require nothing more than cargo add nannou and cargo build to get going.
  • No unsafe code with the exception of bindings to operating systems or hardware APIs.
  • Remove the need to decide between lots of different backends that provide access to the same hardware. Instead, we want to focus on a specific set of backends and make sure that they work well.

Why Rust?

Rust is a language that is both highly expressive and blazingly fast. Here are some of the reasons why we choose to use it:

  • Super fast, as in C and C++ fast.
  • A standard package manager that makes it very easy to handle dependencies and share your own projects in seconds.
  • Highly portable. Easily build for MacOS, Linux, Windows, Android, iOS and so many others.
  • No header files (and no weird linking errors).
  • Sum Types and Pattern Matching (and no NULL).
  • Local type inference. Only write types where it matters, no need to repeat yourself.
  • A more modern, Ć’unctional and expressive style.
  • Memory safe and data-race-free! Get your ideas down without the fear of creating pointer spaghetti or segfault time-sinks.
  • Immutability by default. Easily distinguish between variables that can change and those that can't at a glance.
  • Module system resulting in very clean and concise name spaces.
  • One of the kindest internet communities we've come across (please visit mozilla's #rust or /r/rust if you're starting out and need any pointers)