09.04.2016 Views

www.ebook777.com

Make_Getting_Started_with_Processing_Second_Edition

Make_Getting_Started_with_Processing_Second_Edition

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.

44 Getting Started with Processing<br />

<strong>www</strong>.<strong>ebook777.com</strong><br />

for (int i = 20; i < 400; i += 20) {<br />

line(i, 0, i + i/2, 80);<br />

}<br />

Example 4-9: Kinking the Lines<br />

size(480, 120);<br />

strokeWeight(2);<br />

for (int i = 20; i < 400; i += 20) {<br />

line(i, 0, i + i/2, 80);<br />

line(i + i/2, 80, i*1.2, 120);<br />

}<br />

Example 4-10: Embed One for Loop in<br />

Another<br />

When one for loop is embedded inside another, the number of<br />

repetitions is multiplied. First, let’s look at a short example, and<br />

then we’ll break it down in Example 4-11 on page 45:<br />

size(480, 120);<br />

background(0);<br />

noStroke();<br />

for (int y = 0; y

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

Saved successfully!

Ooh no, something went wrong!