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.

shapes. The following example, in spite of being raster-based, is still a bit complicated; <strong>and</strong><br />

similar to the last example, the GUI elements require quite a bit of code—therefore, the<br />

sketch will be built in stages. Figure 12-3 shows the completed drawing application.<br />

Figure 12-3. Simple Drawing Application sketch<br />

With this sketch, I tried to create a user-friendly interface with reactive interactive elements<br />

that clearly alert users when they can do something. The inclusion of both button<br />

over states <strong>and</strong> event-specific cursors should make users feel more comfortable mousing<br />

around the sketch. Although the sketch is over 350 lines of code, the functionality <strong>and</strong> feature<br />

set is still very simple. You can draw with a pencil, paintbrush, or eraser. The current<br />

selected paint color is the background color surrounding the three tool buttons. I found<br />

this solution simple to code in comparison to the addition of a highlight box on the actual<br />

palette or some other more complicated alternative. The pencil tool draws a continuous<br />

line, <strong>and</strong> the brush tool draws a line composed of a series of strokes; the faster you move<br />

the brush, the straighter the strokes making up the paint mark. The eraser paints the background<br />

color over whatever it moves across. You can control the size of the marks all three<br />

tools make by using the slider in the top-right of the sketch. I gave the slider h<strong>and</strong>le an<br />

over state as well, similar to the tool buttons, again to give users feedback as they mouse<br />

over it. The clear button fills the entire screen with the currently selected color. Other<br />

things that might be fun to add to the sketch could include a series of pre-made shapes<br />

that you could draw with (simple polygons, ellipses, stars, etc.). I imagined that these could<br />

be created as buttons on the top bar of the sketch (between the <strong>Processing</strong> Paint title <strong>and</strong><br />

the slider). You could also add some imaging filters, such as blur <strong>and</strong> contrast. In addition,<br />

a save function could be added to allow users to capture a screenshot of the art they create<br />

with the sketch.<br />

INTERACTIVITY<br />

591<br />

12

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

Saved successfully!

Ooh no, something went wrong!