xxxxxxxxxx
37
let walker;
let t = 0;
function setup() {
createCanvas(400,400);
walker = new Walker();
background(127);
}
function draw() {
walker.step();
}
class Walker {
constructor() {
let n = noise(t)
let x = map(n,0,1,0,400)
let y = map(n,0,1,0,400)
ellipse(x,y,180,60 )
}
step() {
let choice =random(4);
if (choice < 1) {
this.x++;
}
else {
this.y--;
}
this.x = constrain(this.x, 0, width - 1);
this.y = constrain(this.y, 0, height - 1);
}
}