xxxxxxxxxx
let particles=[]
function setup() {
createCanvas(windowWidth, windowHeight);
background(0);
for(let i=0;i<800;i++){
let newP = new Particle({
// p: createVector(random(width),random(height)),
// p: createVector(0,i),
v: createVector(random(-2,2),random(-2,2)),
p: createVector(width/2,height/2),
// v: createVector(1,0),
a: createVector(0,0),
r: random(5)*random()
})
particles.push(newP)
}
}
function draw() {
particles.forEach(p=>{
p.update()
p.draw()
})
// p.add(v)
// v.add(a)
// v.x+=sin(p.y/10)*0.5
// v.y+=sin(p.y/20)*0.5
// v.x =random(-5,5)
// v.y =random(-5,5)
// fill(p.x/3,p.y/3,frameCount)
// noStroke()
// circle(p.x,p.y, r);
}