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

134<br />

Figure 4-11. Repeating distorted sine curve<br />

When patterns overlap <strong>and</strong> interfere with each other, interesting things happen, such as<br />

moiré patterns. In printing, moiré patterns are usually an unwanted phenomenon, occurring<br />

from interfering line screen frequencies. However, these patterns can also be quite<br />

beautiful, causing interesting visual distortions <strong>and</strong> secondary patterns to emerge. In the<br />

following example sketch (shown in Figure 4-12), the wave pattern continuously redraws<br />

itself, with some of the waveform properties controlled by the position of the mouse during<br />

runtime. In addition, a second concentric ring pattern moves around with the cursor,<br />

causing some interesting distortions to occur. You can also press the mouse <strong>and</strong> hold it,<br />

<strong>and</strong> the ring pattern will grow; when you let go, it will shrink back to its original size.<br />

/* Interference <strong>and</strong> moiré pattern<br />

Ira Greenberg, October 18, 2005 */<br />

float interval;<br />

float spacer;<br />

// Experiment with these values<br />

float angle = 0;<br />

float amplitude = .05;

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

Saved successfully!

Ooh no, something went wrong!