xxxxxxxxxx
//caused by factors inside the system
let r=50, x=50, y=50, vx=0.5, vy=1;
function setup() {
createCanvas(windowWidth, windowHeight);
frameRate(20);
noStroke();
}
function mousePressed(){
y = 50, vy = 9;
}
function draw() {
background(100);
ellipse(x, y, r);
x = x + vx;
y = y + vy;
//vy += 1;
if (y > height-r/2){
vy = -vy // * 0.95;
y = height-r/2;
}
if (x > width-r/2){
vx = -vx;
x = width-r/2;
}
if (x < 0+r/2){
vx = -vx;
x = r/2;
}
if (y < 0+r/2){
vy = -vy // * 0.95;
y = r/2;
}
}