For this week’s assignment we were asked to recreate one of the computer graphics from Computer Graphics and Art Magazine.
I looked at Hiroshi Kawano’s prints:
and made this simplified version that changes with a click:
Here’s how it looks like:
and here’s the code:
float y = 60;
float amplitude = random (30, 10);
float steps = 15;
float timeSteps = 0.01;
float versatz = 10;
float sw = random (0.5, 2);
float strokeAlpha;
int margin = 30;
boolean doReDraw = true;
void setup ()
{
size (800, 700);
smooth();
}
void draw ()
{
if (doReDraw == true)
{
background(255, 0, 255);
y = random (80, 100);
while (y < height+45)
{
setRandomValues ();
drawLines();
y+= random (20, 35);
}
drawMargin();
doReDraw = false;
}
}
void setRandomValues ()
{
noiseSeed ((int) random (100));
sw = random (20, 2);
steps = random (sw*2, 6);
amplitude = random (40, 50);
timeSteps = random (0.1, 0.05);
versatz = random (-100, 200);
strokeAlpha = random (-200, 200);
}
void mousePressed ()
{
doReDraw = true;
}
void drawLines ()
{
noFill ();
strokeWeight (sw);
float noiseValue;
float x = -abs (versatz);
float time = 0.0;
while (x < width + abs (versatz))
{
noiseValue = y - noise (time)*amplitude;
strokeWeight (random (sw*0.5, sw*1.2));
stroke (random (strokeAlpha*0.8, strokeAlpha));
line (x, noiseValue+3, x + random (versatz*0.9, versatz), noiseValue+3+height);
x+= steps;
time += timeSteps;
}
}
void drawMargin ()
{
noStroke();
fill (255, 0, 255);
rect (0, 0, width, margin);
rect (0, height, width, -margin);
rect (0, 0, margin, height);
rect (width, 0, -margin, height);
}

