xxxxxxxxxx
float xPos = 0;
int xSpeed = 2;
void setup() {
size(600, 600);
background(100);
}
void draw() {
//background(200);
float y = sin( xPos/width * TWO_PI * 4) * 100;
fill(255);
ellipse(xPos, y + 120, 20, 20);
float cy = sin( xPos/width * TWO_PI * 4 + PI) * 100;
fill(0);
ellipse(xPos, cy + 120, 20, 20);
xPos += xSpeed;
if (xPos > width) {
xPos = 0;
}
}