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

Create successful ePaper yourself

Turn your PDF publications into a flip-book with our unique Google optimized e-Paper software.

PROCESSING: CREATIVE CODING AND COMPUTATIONAL ART<br />

510<br />

Earlier in the chapter, when we converted a single bouncing rectangle to multiple bouncing<br />

rectangles, the problem mostly boiled down to converting single variables to arrays<br />

<strong>and</strong> using for loops in setup() <strong>and</strong> draw() to process them; this is pretty much the case<br />

with this last example. The springing principle works similarly to the previous Ravenous<br />

Triangle II example. There are, however, two aspects that probably need clarification.<br />

The first challenge with the worm was keeping the springing values within a logical range<br />

so that the worm moved properly (based on my own aesthetic sense). I actually have no<br />

idea about real worm motility—other than I suspect it involves slithering.<br />

First, notice the for loop:<br />

for (int i=0; i

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

Saved successfully!

Ooh no, something went wrong!