sketch = p => {
let walker
p.setup = () => {
p.createCanvas(width, 600)
walker = walkerFactory(width/2, 600/2)
p.background(13,15,5)
};
p.draw = () => {
walker.update()
walker.show()
}
function walkerFactory (x, y) {
return {
x,
y,
create: () => p.createVector(x, y),
update () {
this.x = this.x + p.random(-10, 10)
this.y = this.y + p.random(-10, 10)
return this
},
show () {
p.stroke(222,61,131, 90)
p.strokeWeight(8)
p.point(this.x, this.y)
}
}
}
}