xxxxxxxxxx
57
count = 0;
function setup() {
createCanvas(800, 800);
background(245, 243, 240);
xS = 0;
x1 = xS;
x2 = width-xS;
yR = random(400, 800);
y1 = 200;
y2 = 200;
rR = random(0, 255);
rG = random(0, 255);
rB = random(0, 255);
noFill();
}
function draw() {
if (x1 < 200 || x1 > 600 || y1 < 200 || y1 > 600) {
stroke(245, 243, 240);
} else {
stroke(rR, rG, rB);
}
ellipse(x1, y1, 1);
x1 = x1 + 1;
y1=y1+1;
if (x2 < 200 || x2 > 600 || y2 < 200 || y2 > 600) {
stroke(245, 243, 240);
} else {
stroke(rR, rG, rB);
}
ellipse(x2, y2, 1);
x2 = x2 - 1;
y2=y2+1;
if (y1 > yR) {
xS = xS+random(2,20);
x1 = xS;
x2 = width-xS;
y1 = 200;
y2 = 200;
yR = random(400, 800);
rR = random(0, 255);
rG = random(0, 255);
rB = random(0, 255);
count=count+1;
}
if (count == 31) {
noLoop();
}
}