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.

Figure 9-13. Simple Quad sketch<br />

Next is a more interesting quad() example that also includes <strong>Processing</strong>’s resetMatrix()<br />

function, used to reset the affine transformation matrix discussed earlier (see Figure 9-14):<br />

// Disintegrating Quad Wall<br />

float r<strong>and</strong>Shift = .2;<br />

int quadW = 15;<br />

int quadH = quadW;<br />

float[]q = { -quadW/2, -quadH/2, quadW, quadH };<br />

void setup() {<br />

size(600, 600);<br />

background(255);<br />

smooth();<br />

noStroke();<br />

/* generate a table structure of<br />

quads progressivley adding more<br />

r<strong>and</strong>omization to each quad */<br />

for (int i=0, k=1; i

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

Saved successfully!

Ooh no, something went wrong!