xxxxxxxxxx
34
let velocity= 0.8;
let velocity2 = 1.7;
let offset = 0;
let offset2 =0 ;
let w = 0;
let h = 0;
function setup() {
createCanvas(600, 600);
}
function draw() {
fill(0);
offset = velocity + offset;
offset2 = velocity2 + offset2;
background(220, 220,220,30);
w = 0 + offset;
h = 0 + offset2;
ellipse(w, h, 50);
if((w > width)){
velocity = -velocity;
}
if((h > height)){
velocity2 = -velocity2;
}
if(w < 0){
velocity = -velocity;
}
if(h < 0){
velocity2 = -velocity2;
}
}