xxxxxxxxxx
61
var radius= 25;
var d = 0;
var e = 400;
var speed = 1;
var direction= -1;
function setup() {
createCanvas(400, 400);
}
function draw() {
background(0);
odd();
}
function odd(x,y){
translate (x,y);
d += speed * direction;
if ((d > height) || (d < 0)){
direction = -direction;
}
if (direction == 1){
for (var i = 0; i < 100; i++){
stroke(255);
noFill();
ellipse(0,d*25,radius, radius);
}
} else {
stroke(255);
noFill();
ellipse(0,d,radius,radius);
}
}
function even(x,y){
translate (x,y);
e -= speed * direction;
if ((e > height) || (e < 0)){
direction = -direction;
}
if (direction == 400){
stroke(255);
noFill();
ellipse(30,e,radius, radius);
} else {
stroke(255);
noFill();
ellipse(30,e,radius,radius);
}
}