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

48<br />

After being somewhat satisfied with the branch algorithm, I started playing with the code.<br />

The first thing I did was add some r<strong>and</strong>om functions that moved the branches in slightly<br />

different places. The r<strong>and</strong>om functions contribute to the happy mistakes. Sometimes, I’ll<br />

put in values that are outside of a reasonable range just to see what happens. Already this<br />

started looking better (see Figure 2-4).<br />

Figure 2-4. R<strong>and</strong>omness added to the branch structure<br />

Next, I added thickness (using the radius variable) to give the tree some form. Beginning<br />

with a larger radius value—not really a radius, but more like thickness—for the trunk, I<br />

decremented the radius variable slowly each time the function ran, letting the branches<br />

slowly attenuate. This began looking a little more tree-like, as you can see in Figure 2-5.<br />

Figure 2-5. Stroke weight variation begins to create a more realisticlooking<br />

tree.

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

Saved successfully!

Ooh no, something went wrong!