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.

PROCESSING: CREATIVE CODING AND COMPUTATIONAL ART<br />

204<br />

negative padding do to the table structure? You can also make things more interesting<br />

by adding r<strong>and</strong>omization directly into the plotting algorithm. Your table will then go from<br />

an array of cells or windows to (potentially) many little individual works of art (see<br />

Figure 6-27).<br />

/*<br />

Table Layout II<br />

Ira Greenberg, November 21, 2005<br />

*/<br />

void setup(){<br />

size(700, 500);<br />

background(0);<br />

drawTable();<br />

}<br />

void drawTable(){<br />

stroke(255);<br />

int[]caps = { ROUND, PROJECT, SQUARE };<br />

strokeWeight(.1);<br />

int cols = 20;<br />

int rows= 20;<br />

int xPadding = 100;<br />

int yPadding = 100;<br />

float w = (width-xPadding)/cols;<br />

float h = (height-yPadding)/rows;<br />

float colSpan = (width-cols*w)/(cols+1);<br />

float rowSpan = (height-rows*h)/(rows+1);<br />

float x;<br />

float y = rowSpan;<br />

for (int i=0; i

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

Saved successfully!

Ooh no, something went wrong!