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.

You can actually use this painting effect to generate an image over time. In the next example,<br />

100 rectangles move across the screen with varying positions, sizes, <strong>and</strong> colors (shown<br />

in Figure 11-2):<br />

// Painting Stripes<br />

int x;<br />

float speedX = 3.0;<br />

int shapes = 100;<br />

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

float[]w = new float[shapes];<br />

float[]h = new float[shapes];<br />

color[]colors = new color[shapes];<br />

void setup(){<br />

size(400, 400);<br />

frameRate(30);<br />

noStroke();<br />

// fill arrays will r<strong>and</strong>om values<br />

for (int i=0; i

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

Saved successfully!

Ooh no, something went wrong!