xxxxxxxxxx
48
var e = {
x: 0,
y: 0,
r: 0,
sx: 0,
sy: 0
}
function setup() {
createCanvas(600, 400);
fill(random(0, 255));
stroke(random(0, 255));
e.sy = random(1, 5);
e.sx = random(1, 6);
e.x = random(width/2);
e.y = random(height);
e.r = random(20, 30);
}
function draw() {
// background(0, 0);
c = random(180, 255);
c1 = random(180, 255);
c2 = random(180, 255);
strokeWeight(5);
if (e.x > width - 8 || e.x < 8) {
e.sx = e.sx * -1;
fill(c2, c1, c);
stroke(c, c1, c2);
e.r = random(20, 80);
}
if (e.x > 0 && e.x < width) {
background(0)
}
if (e.y > height - 8 || e.y < 8) {
e.sy = e.sy * -1;
fill(c1, c, c2);
stroke(c, c1, c2);
e.r = random(20, 80);
}
ellipse(e.x, e.y, e.r, e.r);
e.x = e.x + e.sx;
e.y = e.y + e.sy;
}