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

Create successful ePaper yourself

Turn your PDF publications into a flip-book with our unique Google optimized e-Paper software.

}<br />

}<br />

// detect boundary collision<br />

// right<br />

if (ellipseX > width-ellipseRadius){<br />

ellipseX = width-ellipseRadius;<br />

directionX *= -1;<br />

}<br />

// left<br />

if (ellipseX < ellipseRadius){<br />

ellipseX = ellipseRadius;<br />

directionX *= -1;<br />

}<br />

// top<br />

if (ellipseY < ellipseRadius){<br />

ellipseY = ellipseRadius;<br />

directionY *= -1;<br />

// r<strong>and</strong>omize base top<br />

baseY1 = r<strong>and</strong>om(height-300, height);<br />

baseY2 = r<strong>and</strong>om(height-300, height);<br />

}<br />

}<br />

Figure 11-19. Non-orthogonal Reflection sketch<br />

MOTION<br />

529<br />

11

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

Saved successfully!

Ooh no, something went wrong!