Peer Review 1

By Treon

4 more days and i only found 2 other people who updated their blog (anything which is posted from july onwards). No other source was told so i took the urls of the blogs used in the previous semester.

The one i could review now is the one by Matthew Brown. It is not really what i call a piece of work. Its more like a small practice. Anyways, his practice is on the random walk which was discussed in week 2’s tutorials. Since there isn’t even much to review, i would supply some suggestions to his practice instead (assuming he is not fluent with programming).

His sample code:

float x = random(width);

float y = random(height);

float x2 = random(width);

float y2 = random(height);

 

void setup()

{

size(400, 400);

strokeWeight(10);

smooth();

background(100);

frameRate(12);

}

 

void draw()

{

x += int(random(width*2)-width);

y += int(random(height*2)-height);

x2 += int(random(width*2)-width);

y2 += int(random(height*2)-height);

stroke(random(255));

line(x, y, x2, y2);

}

Unfortunately this still draws a new line every frame that is not necessarily joined to the line from the previous frame.

Firstly, having int(random(width*2)-width) is totally unnecessary and redundant since the expected outcome could simply be replaced with a int(random(-width, width)) which reduces the number of calculation the cpu does per cycle. it would also make it look more readable.
Secondly would be the the question of “continuing” the line after each frame.
a sample of the code if i were to do it:

float x2 = 0;

float y2 = 0;

float x = random(width);

float y = random(width);

float tempx = 0;

float tempy = 0;

void setup()

{

size(400, 400);

strokeWeight(10);

smooth();

background(100);

frameRate(12);

}

void draw()

{

x2 = random(-width, width);

y2 = random(-height. height);

stroke(random(255));

line(x ,y, x2, y2);

x = x2;

y = y2;

}

of course, changing this bit would only allow the lines to have a continuous look. However, due to the random stroke in the middle of the draw() function, the work will still have a discontinuous effect because of the changing line colors every time it “turns”. To solve this, there are a lot of approach to it. Personally, i would create multiple arrays of the moving lines and each line will have their own color to avoid the breaking colors. Also, instead of having draw the line from point to point directly, i would use a path and draw out the line slowly to let the viewer have the feel that the lines are indeed “walking” and not just sprouting out of no where.

One Response to “Peer Review 1”

  1. Walking Lines 3 - Processing | matthewbrown.net.au Says:

    [...] I received some feedback on my earlier versions of the walking lines in the form of a trackback from Alex. [...]

Leave a Reply