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.

hour h<strong>and</strong><br />

strokeWeight(2);<br />

stroke(50);<br />

float h = hour();<br />

float hourH<strong>and</strong>X = x+cos(radians(30*h-90))*(r*.5);<br />

float hourH<strong>and</strong>Y = y+sin(radians(30*h-90))*(r*.5);<br />

line(x, y, hourH<strong>and</strong>X, hourH<strong>and</strong>Y);<br />

//minute h<strong>and</strong><br />

strokeWeight(1);<br />

stroke(150);<br />

float m = minute();<br />

float minuteH<strong>and</strong>X = x+cos(radians(6*m-90))*(r*.7);<br />

float minuteH<strong>and</strong>Y = y+sin(radians(6*m-90))*(r*.7);<br />

line(x, y, minuteH<strong>and</strong>X, minuteH<strong>and</strong>Y);<br />

//second h<strong>and</strong><br />

strokeWeight(1);<br />

stroke(200, 100, 30);<br />

float s = second();<br />

float secondH<strong>and</strong>X = x+cos(radians(6*s-90))*(r*.9);<br />

float secondH<strong>and</strong>Y = y+sin(radians(6*s-90))*(r*.9);<br />

line(x, y, secondH<strong>and</strong>X, secondH<strong>and</strong>Y);<br />

}<br />

Figure A-10. Analog Clock sketch<br />

PROCESSING LANGUAGE API<br />

709<br />

A

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

Saved successfully!

Ooh no, something went wrong!