For the past few years, Processing has been gaining momentum in the industry and
I've been wanting to pick it up ever since I first discovered it. With two books out now,
it's great to have a quick reference guide to read both on and offline and I put in what spare time I have playing around.
The great thing about Processing is that it doesn't quite have the learning curve you have with Flash because the tools you use
to create your work are much more simplified. To demonstrate this, I wanted to show how a few lines of simple code can create seemingly complex visuals. And
with just a few minor tweaks, you can create drastically different results. I am not going to dive into every line. I'd rather just show the work and associated code.
I picked this one from several dozen because I was drawn to the simplicity of execution and complexity of the result.
The code below builds a sine wave with a damper so the frequency, or size of the wave, becomes less volital with each pass. Playing with a few
numbers in the code, such as the frequency, the width (w) and damping can show some of the following results:
/*
SineWorm
Programmer: Wes Grubbs (www.devedeset.com)
*/
size(961, 390);
background(255);
float angle = 0;
float amplitude = 180;
float w = 255;
float h = w;
float x = -w;
float y = 0;
float xSpeed = 1.8;
float frequency = 5.0;
float damping = .995;
strokeWeight(2);
smooth();
noFill();
for(int i=0; i<width*2; i+=xSpeed) {
x += xSpeed;
y = height/2 + sin(radians(angle)) * amplitude;
arc(x, y, w, h, 0, TWO_PI);
amplitude *= damping;
angle += frequency;
xSpeed+=.01;
}