SketchBook

var rad = 60;
var xpos, ypos;

var xspeed = 100.50;
var yspeed = 1.1;

var xdirection = 1;
var ydirection = 1;

function setup() {
createCanvas(windowWidth,
windowHeight);
noStroke();
ellipseMode(RADIUS);

xpos = width / 2;
ypos = height / 2;
}

function draw() {
background(10,100,457);
fill(777,985,647);

xpos = xpos + xspeed * xdirection;
ypos = ypos + yspeed * ydirection;

if (xpos > width - rad || xpos < rad) {
xdirection *= -1;
}

if (ypos > height - rad || ypos < rad) {
ydirection *= -1;
}

ellipse(xpos, ypos, rad, rad);
}
fill(250,0,0);
ellipse(35,50,60,60);
fill(0,0,255,100);
ellipse(65,50,60,60);