Out of curiosity, I also ported the sketch to processing.js (which was pretty straightforward) you can see the result here. It barely scratches the surface of what can be done, but it’s a fun demo. I decided to make a quick project, starry.py with fast_star and scikit-image. Īnd, as advertised earlier, Python’s many great libraries are easily callable from Nodebox. Rewriting star in OpenGL (and some cute tricks), I was able to commit fast_star, a function that runs 23x faster. Interestingly, it was implemented using an inefficient intermediate class (BezierPath) instead of directly in OpenGL, like the other primitives. My rendered output is here: (I used ImageMagick to stitch the frames together – it’s a ~9 MB animated gif)Ĭlick the photo above to open the animationĭespite its performance problems, Nodebox does have a primitive that Processing is lacking however, the star. That’s a hell of a performance price to pay. BoxyLady2, a 72-line sketch by analogpixel became 20 lines shorter (yay!), but also 11x slower (.375 fps for NodeBox, 4.4 fps for Processing v2.0b9). Once that was out of the way, I decided the most instructive thing to do was to port an existing Processing sketch to Nodebox. If you have mercurial, git, and pip installed, it’s not too bad (on OSX, you need to install pyglet from HEAD because version 1.2, which switches from using Carbon to Quartz, has not yet been released): pip install hg+ So, I decided to give it a whirl and installed Nodebox-OpenGL (hereafter referred to as “Nodebox”). And although Nodebox lacks Processing’s vibrant community of developers and rich ecosystem (including geomerative and toxiclibs) Nodebox comes with a lot built-in ( flocking, particle systems, graphs), plus easy access to all the goodies you could ever want in Python. Nodebox lets you code in Python instead of Java. Lynn Cherny’s talk, Data Visualization with Nodebox ( Slides, Video) made an excellent case for using Nodebox as a framework for creative data visualization instead of Processing. The good news is: there’s lots of low-hanging fruit. Shoes also borrows some animation ideas from Processing and will continue to closely consult Processing's methods as it expands.TL DR: Nodebox-OpenGL gives you the sugar and power of Python and the ease of Processing, but with a significant speed penalty. And Green Shoes also allows images and gradients to be used for drawing lines and filling in shapes. For example, Green Shoes has different color methods, including having its own RGB array, though these are very similar to Processing's color methods. Green Shoes does a few things differently from NodeBox and Processing. I owe a great debt to the creators of these wonderful programs! In turn, NodeBox gets much of its ideas from Processing, a Java-like language for graphics and animation. The artful methods generally come verbatim from NodeBox, a drawing kit for Python. See the section on Colors for more on how to mix colors. The blue and red methods above are RGB array. One-hundred pixels wide, placed just a few pixels southeast of the window's upper left corner. That code gives you a blue pie with a red line around it. And the fill command sets the color used to paint inside the lines. You'll need to set up the paintbrush colors first, though. Many common shapes can be drawn with methods like oval and rect. Each slot is like a canvas, a blank surface which can be covered with an assortment of colored shapes or gradients.
0 Comments
Leave a Reply. |