xxxxxxxxxx
28
/*
* @name Brownian Draw
* @description Use random steps to draw interesting shapes
*
*/
function setup() {
let x = 250;
let y = 250;
let newx = x;
let newy = y;
// Sets the screen to be 720 pixels wide and 400 pixels high
createCanvas(500, 500);
background(0);
noSmooth();
// Draw gray box
stroke(255);
for (let i=0; i<10000; i++) {
newx = x + (random()-.5)*10
newy = y + (random()-.5)*10
line(x, y, newx, newy);
x = newx;
y = newy;
}
}