xxxxxxxxxx
let particles = []
function setup() {
createCanvas(windowWidth, windowHeight);
background(255);
for (let i =0; i < 800; 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),
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/5)*2
// v.y += sin(p.y/5)*2
// // v.x = random(-5,5)
// // v.y = random(-5,5)
// fill(255,p.y/3,frameCount)
// noStroke()
// circle(p.x, p.y, r);
}