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.

Summary<br />

We began this chapter comparing Java <strong>and</strong> <strong>Processing</strong>’s approach to coding interactivity.<br />

As usual, compared to pure Java, <strong>Processing</strong> simplifies interactivity. Using <strong>Processing</strong>’s<br />

built-in mouse event functions, I coded some simple sketches that reacted to the user’s<br />

mouse presses, as well as mouse releases. I compared functions such as mousePressed()<br />

with their companion Boolean variables of the same name (mousePressed), <strong>and</strong> looked at<br />

some examples that used both. I also discussed the difference between <strong>Processing</strong>’s<br />

mouseMoved() <strong>and</strong> mouseDragged() functions. Developing some longer examples, I created<br />

a node-based shape-building <strong>and</strong> animation sketch <strong>and</strong> also a simple paint program,<br />

including a custom GUI with reactive multi-state buttons <strong>and</strong> a draggable slider. After the<br />

mouse events, we looked at <strong>Processing</strong>’s keyboard events, which work similarly to the<br />

mouse events. I compared coded keys, such as the arrow keys, defined as constants in<br />

<strong>Processing</strong>, with the st<strong>and</strong>ard keyboard keys—letters, numbers, <strong>and</strong> so forth. Finally, I created<br />

an animated paint program that was completely controlled by keyboard events. To<br />

learn more about pushing <strong>Processing</strong>’s event detection <strong>and</strong> h<strong>and</strong>ling capabilities beyond<br />

the mouse <strong>and</strong> keyboard, check out the <strong>Processing</strong> libraries (http://processing.org/<br />

reference/libraries/index.html).<br />

The final two chapters of the book introduce coding 3D in <strong>Processing</strong>—one of the most<br />

exciting features of the language.<br />

INTERACTIVITY<br />

613<br />

12

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

Saved successfully!

Ooh no, something went wrong!