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

158<br />

Troubleshooting: This page covers many of the common “Help me, something’s not<br />

right with the <strong>Processing</strong> universe!” concerns voiced on the discourse board; you<br />

can think of this page as the triage FAQ.<br />

Reference: This provides you with reference to the entire <strong>Processing</strong> language API,<br />

which is stored locally on your hard drive. This is the place to go to learn about<br />

specific comm<strong>and</strong>s in the <strong>Processing</strong> language. Please note that this page opens to<br />

an abridged language reference. You’ll need to select the Extended option to see<br />

the entire language. For the very latest information, refer to http://processing.<br />

org/reference/index.html.<br />

Find in Reference (Cmd+Shift+F on OS X; Ctrl+Shift+F on Windows): Select a word<br />

in your sketch <strong>and</strong> then select Find in Reference. If the word exists in the <strong>Processing</strong><br />

API, the relevant reference information will be opened in your default web<br />

browser.<br />

Frequently Asked Questions: This comm<strong>and</strong> opens a list of questions <strong>and</strong> answers to<br />

some common <strong>Processing</strong> issues. The online version is at http://processing.org/<br />

faq.html.<br />

Visit <strong>Processing</strong>.org (Cmd+5 on OS X; Ctrl+5 on Windows): This comm<strong>and</strong> launches<br />

your default web browser <strong>and</strong> loads http://processing.org/.<br />

Programming modes<br />

<strong>Processing</strong> supports three different modes of coding, allowing users with different skill <strong>and</strong><br />

experience levels to work most efficiently <strong>and</strong> comfortably, all within the same environment.<br />

It is even possible to mix these different modes within the same project.<br />

Basic mode<br />

In basic mode, users simply type individual lines of comm<strong>and</strong>s sequentially into the text<br />

editor window, without the added complexity of more complex structures, such as functions<br />

or classes. This is an excellent mode for br<strong>and</strong> new coders to learn about programming<br />

fundamentals—such as basic syntax, coordinates, variables, <strong>and</strong> loops—<strong>and</strong> also to<br />

get more familiar with the <strong>Processing</strong> language <strong>and</strong> environment. The following code is<br />

structured in basic mode <strong>and</strong> generates a simple tan circle, with a black stroke on a lavender<br />

background:<br />

size(200, 200);<br />

background(130, 130, 240);<br />

stroke(0);<br />

fill(200, 150, 101);<br />

int x = 100;<br />

int y = 100;<br />

int w = 140;<br />

int h = 140;<br />

ellipse(x, y, w, h);

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

Saved successfully!

Ooh no, something went wrong!