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.

Figure 10-8. Nematode sketch (stage 2)<br />

In this stage, I mostly just added some more ellipses, controlling their radii <strong>and</strong> color/alpha.<br />

I also added a sin() function, with r<strong>and</strong>om amplitude to add some jitter to the nematode’s<br />

body. I think nematodes are actually pretty smooth, but I’ll invoke artistic license<br />

here. Here’s a finished nematode (see Figure 10-9):<br />

/*<br />

Finished Nematode<br />

Ira Greenberg, January 7, 2006<br />

*/<br />

void setup(){<br />

size(500, 300);<br />

background(255);<br />

smooth();<br />

strokeWeight(.2);<br />

noFill();<br />

float radius = 0;<br />

float thickness = .35;<br />

float x = 0;<br />

float y = height/2;<br />

float amp = .5;<br />

float angle = 0;<br />

float angle2 = 0;<br />

//ground plane<br />

stroke(150, 100, 20);<br />

line(0,50, width, 50);<br />

for (int i=0; i= width/2-40) {<br />

fill(195, 110, 105, 50);<br />

}<br />

else if (i >= width/4-40 && i

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

Saved successfully!

Ooh no, something went wrong!