04.04.2013 Views

Processing: Creative Coding and Computational Art

Processing: Creative Coding and Computational Art

Processing: Creative Coding and Computational Art

SHOW MORE
SHOW LESS

You also want an ePaper? Increase the reach of your titles

YUMPU automatically turns print PDFs into web optimized ePapers that Google loves.

PROCESSING: CREATIVE CODING AND COMPUTATIONAL ART<br />

136<br />

// allows ring to shrink<br />

void mouseReleased(){<br />

isInactive = true;<br />

}<br />

Figure 4-12. Moiré pattern<br />

The final example simulates organic motion. The development of this example is also<br />

worth describing, as it’s a good illustration of the power of “happy coding mistakes,” as I<br />

described in Chapter 2.<br />

I originally set out to create an example entitled Springy Serpent. I imagined a series of<br />

nodes, connected by tethers, moving around the screen in a snake-like manner, with<br />

springs controlling some of the motion of the serpent’s body. I’d solved similar problems<br />

to this in the past, but I tend to not look at old code when I begin creating, <strong>and</strong> I couldn’t<br />

quite visualize (or remember) how to pull this off. I don’t necessarily recommend this<br />

“start from scratch” approach, <strong>and</strong> I’d say most coders take the exact opposite approach—<br />

using snippets of their older code <strong>and</strong> not repeating the same mistakes over <strong>and</strong> over<br />

again. One benefit of my illogical approach is the interesting stuff I find along the way. In<br />

the process of developing the springy serpent, I made some initial logic errors in my algorithm.<br />

I got some of the behavior, but not all of it. I also realized that I really needed to get

Hooray! Your file is uploaded and ready to be published.

Saved successfully!

Ooh no, something went wrong!