xxxxxxxxxx
36
// Daniel Rautenbach
// Nature of Code Week 1
// Random Walk
let position;
function setup() {
createCanvas(500, 500);
position = createVector(random(width), random(width));
s = 1;
inc = 10;
}
function draw() {
background(0);
stroke(0, 255, 0);
strokeWeight(1);
noFill();
beginShape();
vertex(position.x, position.y);
endShape(CLOSE);
ellipse(position.x, position.y,16);
// TO DO?
// let velocity = p5.random2D(); ???
// anything here?
// position.add(velocity);
position.x = position.x + random(-10, 10);
position.y = position.y + random(-10, 10);
}