Drunken Walk

to generate a new and unique variation

Source Code

Every variart piece is open source, you can see exactly how it is drawn from the code.




var length = intVariable('length', 50, 200);
var stepMagnitude = intVariable('stepMagnitude', 10, 30);
var x = width/2;
var y = height/2;
var points = [];

for (var i = 0; i < length; i++){
  var newX = x + getRandomInt(-stepMagnitude, stepMagnitude);
  var newY = y + getRandomInt(-stepMagnitude, stepMagnitude);
  
  points.push([x, y, newX, newY])
              

  x = newX
  y = newY
}

s.polyline(points).attr({fill: 'none', strokeWidth: 3, stroke: 'black'});