The Artist's Husband: Rust and Nannou

/2024/01/the-artists-husband-rust-and-nannou/images/nannou_draw.png

In my last post , I mentioned Nannou , a generative art framework for the Rust programming language. While I am focusing mainly on drawing here, Nannou goes much further dealing with user interface, audio and video, and even lasers ! Its goal is to provide tools for artists building any kind of art installation.

For drawing, it is similar to Processing in how it is used, and therefore similar to all the other frameworks I’ve discussed here, which are all based on, or at least inspired by, Processing.

Nannou has many examples. To try them out, you will need to install a few things, notably Rust and an IDE, on your computer system. The Nannou Getting Started page will guide you through the process of installing what you need.

Once you have Rust and the other tools installed, go to a directory where you want to install Nannou and run this command:

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

Now switch to the nannou directory you just created:

cd nannou

You should be able to start running examples now, according to the Nannou documentation, but I had to do a couple of more steps. First, I updated the versions of the dependencies:

cargo update

…then I cleaned up build artifacts:

cargo clean

Whether you have to run those last two commands may depend on what version of your operating system you have. I am using MacOS Ventura 13.6.1. It won’t hurt to run them even if you don’t need them.

At long last, you can run some the examples!

cargo run --release --example draw

This will draw an image much like the one at the top of this post, except that it will be animated and will interact with the mouse!

Next week, we’ll have a look at how a Nannou program is structured.