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.

86 Getting Started with Processing<br />

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

void setup() {<br />

size(360, 480);<br />

ellipseMode(RADIUS);<br />

}<br />

void draw() {<br />

strokeWeight(2);<br />

float neckY = -1 * (bodyHeight + neckHeight + radius);<br />

background(0, 153, 204);<br />

translate(mouseX, y); // Move all to (mouseX, y)<br />

if (mousePressed) {<br />

scale(1.0);<br />

} else {<br />

scale(0.6); // 60% size when mouse is pressed<br />

}<br />

// Body<br />

noStroke();<br />

fill(255, 204, 0);<br />

ellipse(0, -33, 33, 33);<br />

fill(0);<br />

rect(-45, -bodyHeight, 90, bodyHeight-33);<br />

// Neck<br />

stroke(255);<br />

line(12, -bodyHeight, 12, neckY);<br />

// Hair<br />

pushMatrix();<br />

translate(12, neckY);<br />

float angle = -PI/30.0;<br />

for (int i = 0; i

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

Saved successfully!

Ooh no, something went wrong!