xxxxxxxxxx
//condizioni iniziali moto rettilineo uniforme
let X= 0
let Y= 100
let Vx=5
let Vy=4
function setup() {
createCanvas(windowWidth, windowHeight);
;
}
//pallina
function draw() {
background(0)
fill (random(100,255), random(100,255), random(100,255))
textSize(50)
text('DVD',X,Y);
//leggi orarie (t sottinteso per esecuzione funzione draw)
X=X+Vx
Y=Y+Vy
//creazione spazio circolare
if (X>width-100)
Vx=-Vx
if (Y>height)
Vy=-Vy
if (X<0)
Vx=-Vx
if (Y<40)
Vy=-Vy
}