xxxxxxxxxx
function draw() {
circle(100, 100, 200);
}
function setup() {
createCanvas(windowWidth, windowHeight);
colorMode(HSB);
w = 510;
h = 305;
s = 0.3;
x = 0;
y = 0;
xvel = 2;
yvel = 2;
bgColor = color(220);
}
function draw() {
background(bgColor);
circle(circle, x, y, w * s, h * s);
x += xvel;
y += yvel;
if (x > width - (w * s) || x < 0) {
xvel *= -1;
bgColor = color(random(0,360), 70, 100);
}
if (y > height - (h * s) || y < 0) {
yvel *= -1;
bgColor = color(random(0,360), 70, 100);
}
}