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.

Figure 7-8. Revealing the points making up the curve<br />

In Figure 7-7, I just decreased xSpeed, making the curve fall faster, since the x progression<br />

is slower. In the second example, I increased both variables considerably, maintaining a<br />

similarly shaped curve, but with a much faster overall progression, revealing the points<br />

making up the curve.<br />

I want to look at some other relatively simple ways to generate curves; but before I do,<br />

here are some more interesting examples building upon what you just learned<br />

(see Figure 7-9). (If you don’t see any output in the examples, try raising the<br />

strokeWeight(1.5) argument from 1.5 to 2 or above).<br />

/*<br />

Curves I<br />

Ira Greenberg, December 4, 2005<br />

*/<br />

int steps = 300;<br />

float[]x = new float[steps];<br />

float[]y = new float[steps];<br />

float[]xSpeed = new float[steps];<br />

float[]ySpeed = new float[steps];<br />

void setup(){<br />

size(400, 400);<br />

background(255);<br />

float margin = height*.1;<br />

smooth();<br />

strokeWeight(1.5);<br />

CURVES<br />

249<br />

7

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

Saved successfully!

Ooh no, something went wrong!