xxxxxxxxxx
let particles=[]
function setup() {
createCanvas(windowWidth, windowHeight);
background(255);
for(let i=0;i<600;i++){
let newP = new Particle({
// p: createVector(random(width),random(height)),
p: createVector(0,i),
// v: createVector(random(-1,1),random(-1,1)),
// p: createVector(width/2,height/2),
v: createVector(1,0).rotate(random()*2*PI*0),
a: createVector(0,0),
r: random(3)*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);
}