xxxxxxxxxx
//tempo
let t, dt;
function setup() {
createCanvas(windowWidth, windowHeight);
//variabili definizione
t = 0;
dt = 1;
//creazione oggetto
p = new Particella(width / 2, height / 2, 1.2, -2.7, 20);
p2 = new Particella(200, 300 , -3, 6, 50);
p3=new Particella(100,200,4.7,-2,70)
}
function draw() {
background(255)
fill(255, 0, 0)
//aggiornare variabili stato
textSize(15)
text("tempo: " + t, 10, 20)
p.mondo()
p.posizione(dt)
p.oggetto()
p2.mondo()
p2.posizione(dt)
p2.oggetto()
t += dt
p3.mondo()
p3.oggetto()
p3.posizione(dt)
}