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

524<br />

// start ellipse on line<br />

ellipseX = lineX1;<br />

ellipseY = lineY1;<br />

}<br />

void draw(){<br />

background(255);<br />

// draw line<br />

line(lineX1, lineY1, lineX2, lineY2);<br />

//draw ellipse<br />

ellipse(ellipseX, ellipseY, 20, 20);<br />

// move elipse<br />

ellipseX += directionX * ellipseSpeed;<br />

ellipseY += directionY * ellipseSpeed;<br />

// keeps ellipse moving along line<br />

if (ellipseX>lineX2 && ellipseY>lineY2 ||<br />

ellipseX

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

Saved successfully!

Ooh no, something went wrong!