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 />

492<br />

with the following two lines:<br />

fill(255, 40);<br />

rect(0, 0, width, height);<br />

Figure 11-5. Simple Fading sketch<br />

The new rect() call does the same thing as background() (repainting the display window),<br />

only using an alpha setting (below 255) specified for the background color. To<br />

increase the persistence of the trails, try decreasing the alpha value.<br />

Fun with physics<br />

Simulating physics is fun! I realize that this is a pretty nerdy thing to say. But there is something<br />

captivating about seeing a bunch of polygons moving in a naturalistic way. Think<br />

about the moving grass <strong>and</strong> flora in Shrek, the ocean in The Perfect Storm, or the fur in<br />

Monsters, Inc.—<strong>and</strong> of course don’t forget Gollum in The Lord of the Rings. Regrettably,<br />

we won’t begin our exploration of physics simulating reactive fur, tidal waves, or a<br />

demented self-loathing creature. Instead, we’ll add some gravity to our single bouncing<br />

rectangle example (shown in Figure 11-6):

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

Saved successfully!

Ooh no, something went wrong!