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.

PROCESSING: CREATIVE CODING AND COMPUTATIONAL ART<br />

216<br />

/*<br />

Scribble Plotter<br />

Ira Greenberg, November 24, 2005<br />

*/<br />

//some scribble style constants that control<br />

//how the scribble plotting works<br />

int SCRIBBLE = 0;<br />

int HATCHING = 1;<br />

void setup(){<br />

size(300, 300);<br />

background(0);<br />

// create arrays to hold x, y coords<br />

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

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

// create a convenient 2 dimensional<br />

// array to hold x, y arrays<br />

float[][]xy = {x, y};<br />

//record points<br />

//x positions<br />

xy[0][0] = 50;<br />

xy[0][1] = 250;<br />

xy[0][2] = 250;<br />

xy[0][3] = 50;<br />

//y positions<br />

xy[1][0] = 50;<br />

xy[1][1] = 50;<br />

xy[1][2] = 250;<br />

xy[1][3] = 250;<br />

// call plotting function<br />

makeRect(xy);<br />

}<br />

void makeRect(float[][]pts){<br />

stroke(255);<br />

smooth();<br />

// scribble variables, that get passed as arguments<br />

// to the scribble function<br />

int steps = 100;<br />

float scribVal = 3.0;<br />

for (int i=0; i

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

Saved successfully!

Ooh no, something went wrong!