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.

Creating space through fades<br />

Your last modification will be shifting the value of the stroke. Since color is represented<br />

numerically, you can easily shift the color’s value/chroma just by applying some calculations<br />

to the color’s numeric value. Going back to the vertical lines example, here’s the<br />

output fading to black. Notice how it feels like the form goes back into space (see<br />

Figure 6-16).<br />

size(300, 300);<br />

background(0);<br />

float cellWidth = width/30.0;<br />

// find ratio of value range(255) to width<br />

float val = cellWidth*(255.0/width);<br />

//vertical lines<br />

for (float i=cellWidth, v=255; i

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

Saved successfully!

Ooh no, something went wrong!