Nannou – A creative coding framework for Rust

(github.com)

55 points | by dmit 4 days ago ago

19 comments

  • pjmlp a day ago ago

    The problem with creative coding and languages like Rust, or C++ for that matter, is that long compilation times break down the interactivity that is expected in such workflows.

    • neobrain a day ago ago

      That problem is solved by the subsecond crate (an offspring of the Dioxus UI framework), demo here: https://youtu.be/Kl90J5RmPxY?t=1288

      It's not integrated in Nannou specifically, but they're showing off Bevy and ratatui in that demo, both very popular frameworks in the Rust world. (In fact, Nannou is in the process of being rebuilt on top of Bevy.)

      • binary132 a day ago ago

        I don’t know if something is wrong with my mental model, but it seems weird to me that it would take hundreds of milliseconds to patch a function pointer.

    • kennykartman a day ago ago

      That's true! But I was amazed to see makepad.nl's performances. That's written in Rust and I saw one of the authors, Rik, explain how they make it so fast to build. Praiseworthy job that shows that with care one can go far.

    • CJefferson a day ago ago

      Yes, I wanted to play with things like this, I love Rust, but nowadays I use things built in Python or Lua (like love2d) -- because I need fast interactivity for visual creative coding.

  • ericyd a day ago ago

    I used Nannou for several months, it's actually how I got into creative coding and was my first real foray into Rust. I didn't find the compilation time to be a huge issue for me, but I did find the strictness of Rust to be a problem. Creative coding for me evolved into making beautiful (to me) visual patterns with code. I had no interest in understanding or fixing a mutable shared value because this code was meant to exist for only a few moments, not to power an enterprise system.

    I eventually moved on to OPENRNDR [1] which I loved, but these days I just use TypeScript.

    [1] https://openrndr.org/

    • FireInsight a day ago ago

      OPENRNDR is amazing and I love using it for generative art, especially installations, not so much for stuff to share on the web. I find the API is way more tuned to my programmer brain compared to Processing/p5.js. The only problems, I think, are:

      - It's Kotlin/JVM. Looks pretty, is ergonomic to write in, runs everywhere. But also, I feel forever chained to IntelliJ and cant wrap my head around the build system at all.

      - Small community. Searching for issues, tutorials, or anything of that sort doesn't yield that many results. Not a problem if you're self-sufficient enough, but might stop me from recommending it to a beginner. The development also seems kind of slow.

      • ericyd a day ago ago

        I share these feelings; I don't use JVM anywhere and so booting up IntelliJ just for art felt weird. I eventually decided to write an SVG library in TypeScript heavily inspired by the OPENRNDR API [1]. Of course, if small community is one of your concerns, then I can't help you there, as the community for my library is just me.

        [1] https://github.com/ericyd/salamivg

  • plastic041 2 days ago ago

    It hasn't been actively maintained, but it is still a good crate. Also it has good document unlike other similar crates. I loved this community tutorial: https://github.com/sidwellr/schotter

  • matusnovak a day ago ago

    This reminds me of OpenFrameworks [0], which provides very similar framework style functionality like Nannou but for C++.

    [0]: https://openframeworks.cc/

    • roboben a day ago ago

      yep looks heavily inspired by OF. Anyone knows whats up with that project? I was involved years ago, it seems to still be going but I think many people moved on?

  • lynndotpy a day ago ago

    I got into this with Genuary in 2023 or 2024. I found myself wishing Rust had a flag that would automatically coerce between different integer and float types. Just let me put an i32 where you're expected a u64, an f32 where you want an i64, it'll be okay, I swear!

    • whytevuhuni 13 hours ago ago

      Will it be okay though? i32 to u64 has two ways to convert it:

          i32 -> u32 -> u64
          i32 -> i64 -> u64
      
      This matters with negative numbers, where the first one pads with 32 bits of 0, the second one pads it with 32 bits of 1. Sometimes (as it once happened to me), you wanted the wrong one.
      • lynndotpy 5 hours ago ago

        Yes, it will be okay because I'm making a pretty picture :) If the default behavior of a conversion surprises me, I'd be able to sus it out and replace it with explicit behavior.

        I'm not saying this is worth adding such a thing to Rust just for this use case, but it would be very nice not to write intos for every number

  • toboramai a day ago ago

    This is a cool project, but it seems like it hasn't been updated in a long time?

    It seems like https://github.com/chaosprint/glicol has a similar problem.

    • ThisNameIsTaken a day ago ago

      That is on the main branch. Behind the scenes [1] they're working a a huge rewrite to use the Bevy engine. A big effort that seems to be moving at a quite constant pace. It seems they're doing it quite rigourously: I've seen some issues in the bevy tracker where they check what is specific to their project, or where bevy can use some work.

      [1]: https://github.com/nannou-org/nannou/tree/bevy-refactor

  • paulglx a day ago ago

    Very nice name and reference!

    • 4cidBurn a day ago ago

      I absolutely love the Aphex Twin reference!