xxxxxxxxxx
23
var ballY = 20;
var velocity = 0;
var acceleration = 1.63;
function setup() {
createCanvas(400, 400);
}
function draw() {
//update
if (ballY > height){
velocity = -velocity * 0.9;
ballY = height;
}
velocity += acceleration;
ballY += velocity;
//draw
background(220);
noStroke();
fill(0);
ellipse(width/2, ballY, 10, 10);
}