Walking Lines 1

Semi-random lines sketchIn the week 2 tutorial for KKB211 – Computational Arts 2, we are looking at doing walking lines in our chosen development tool.

Walking lines are effectively randomly generated paths that the lines follow to create a random image.

I have been using Processing for this particular focus. Thus far I have random lines, however they don’t follow any particular path as of yet. This is effectively still walking lines as the position of the lines is added to and built on. Unfortunately this actually draws a new line every frame that is not necessarily joined to the line from the previous frame.

Have a look at it online here.

The code used to do this is extremely simple and just involves a few random variables based on the width and height of the canvas. I don’t believe this is entirely stochastic because the randoms are tightly controlled, but it is random within its boundaries (unless you want to get into the nitty gritty of it, which I don’t).

The source code is available after the jump.

void setup()
{
size(400, 400);
strokeWeight(10);
smooth();
background(0);
}

void draw()
{
float r = random(0, height);
float x = random(0, width);
stroke(r, 100);
line(random(r), random(width), random(x*2), random(height));
}

Tags: , , , , ,

One