xxxxxxxxxx
45
// https://www.openprocessing.org/sketch/611325
const num = 1000;
let walker = [];
function setup() {
createCanvas(windowWidth, windowHeight);
background(0);
for(let i = 0; i < num; i++){
walker[i] = new Walker();
walker[i].position = createVector(random(width), random(height));
}
}
function draw() {
fill(0, 9);
rect(0, 0, width, height);
for(let i = 0; i < num; i++){
walker[i].draw();
}
}
class Walker {
constructor(){
this.position = createVector(width / 2, height / 2);
}
draw(){
for(let i = 0; i < 10; i++){
this.velocity = createVector(random(-1, 1), random(-1, 1));
this.position.add(this.velocity);
noStroke();
fill(255, 31);
circle(this.position.x, this.position.y, 2);
}
}
}