xxxxxxxxxx
21
var dx=1;
var dy=1;
var x=10;
var y=20;
function setup() {
createCanvas(600, 400);
}
function draw() {
background(0);
ellipse(x,y,20,20);
x=x+dx;
y=y+dy;
if( (x>=599)||(x<=1)){
dx=(-dx);
}
if((y>=399)||(y<=1)){
dy=(-dy);
}
}