xxxxxxxxxx
40
const num = 1000;
let walker = [];
function setup(){
createCanvas(windowWidth, windowHeight);
for(let i = 0; i < num; i++){
walker[i] = new Walker();
}
background(0);
}
function draw(){
fill(0, 5);
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(31, 127, 255, 31);
circle(this.position.x, this.position.y, 2);
}
}
}