xxxxxxxxxx
//dichiarazione variabili tempo
let t, dt;
function setup() {
createCanvas(windowWidth, windowHeight);
background(31, 222, 158, 200);
//assegnazione valori tempo
t = 0;
dt = 0.5;
//creazione ball. i cui parametri sono: _x,_y,_ax, _ay,_r,_R,_G,_B
a = new Ball(100, 100, 2, 2, 50, 255, 0, 0);
b = new Ball(random(width), random(height), random(-3, 3), random(-5, 5),
random(10, 150), random(255), random(255), random(255));
c = new Ball(random(width), random(height), random(-3, 3), random(-5, 5),
random(10, 150), random(255), random(255), random(255));
d = new Ball(random(width), random(height), random(-3, 3), random(-5, 5),
random(10, 150), random(255), random(255), random(255));
}
function draw() {
//ellipse(mouseX, mouseY, 20, 20);
background(143, 108, 247, 200);
//testo
fill(0, 255, 0);
textSize(15);
text("tempo: " + t, width / 2, 25);
//incremento del tempo
//t = t + dt
//t = t + 1;
//dt = dt + 1;
t = dt + t;
//funzioni che la ball esegue
a.appearence();
a.movement(t, dt);
a.universe(t, dt);
b.appearence();
b.movement(t, dt);
b.universe(t, dt);
c.appearence();
c.movement(t, dt);
c.universe(t, dt);
d.appearence();
d.movement(t, dt);
d.universe(t, dt);
}