xxxxxxxxxx
let t, dt;
//tempo
let n = 5;
//numero particelle
//array di particelle
let molecola = Array();
function setup() {
createCanvas(windowWidth, windowHeight);
t = 0
dt = 2;
/* x = 100;
y = 100;
vx = 2;
vy = 0.7;
*/
//particelle. parametri: _x, _y, _vx, _vy, _r, _R, _G, _B
p = new Particella(20, 20, 2, 1, 50, 255, 0, 0);
//s = new Particella(width / 2, height / 2, -3, 2, 100, 255, 255, 0);
//a = new Particella(random(width), random(height), random(-10, 10), random(-10, 10),
//random(150), random(255), random(255), random(255));
}
function draw() {
background(100, 255, 170, 150);
//incremento temporale
t = t + dt
//animazione particelle
p.muovi(dt);
p.disegna();
p.universe();
/* s.muovi(dt);
s.disegna();
s.universe();
a.muovi(dt);
a.disegna();
a.universe();
*/
//testo
textSize(20);
textAlign(CENTER);
text("tempo = " + t, width / 2, 100);
/*for (n = 0; n < 5; n += 1) {
a = new Particella(random(width), random(height), random(-10, 10), random(-10, 10),
random(150), random(255), random(255), random(255));
//let = particles.push(a);
a.muovi(dt);
a.disegna();
a.universe();
fill(0);
//ellipse(random(width / 2), random(height / 2), 30);
}*/
}