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

244<br />

y = mx + b. y <strong>and</strong> x are just the coordinate values, m is the slope, <strong>and</strong> b is the place on the<br />

y-axis that the line intercepts. Again, you don’t need to explicitly use the classical equations,<br />

but knowing them can help you better underst<strong>and</strong> what’s happening in your sketch.<br />

Here’s a diagonal line example (shown in Figure 7-2):<br />

/*<br />

Diagonal Line I<br />

Ira Greenberg, December 3, 2005<br />

*/<br />

size(200, 200);<br />

background(255);<br />

int margin = width/15;<br />

strokeWeight(5);<br />

smooth();<br />

float x = margin, y = margin;<br />

float deltaX = 1.2;<br />

float deltaY = 1.2;<br />

if (deltaX>deltaY){<br />

while(x

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

Saved successfully!

Ooh no, something went wrong!