xxxxxxxxxx
int radius =50;
float x= 110 ;
float speed =1.0;
int direction =1;
float angle =0.0;
float offset = 150;
float scalar =40;
float speed2 = 0.05;
void setup(){
size(500, 400);
background(255);
ellipseMode(RADIUS);
//frameRate(100);
}
void draw(){
background(255);
fill(#ff00ff, 127);
noStroke();
x += speed * direction; //xに加算
if ((x > width-radius) || (x < radius )) {
direction = -direction ; //方向を反転
}
if (direction == 1) {
arc(x, 250, radius, radius, 0.52, 5.76); //右向き
} else {
arc(x, 250, radius, radius, 3.67, 8.9); //左向き
}
// fill(#0000ff, 127);
// noStroke();
//x += speed * direction; //xに加算
//if ((x > width-radius) || (x < radius )) {
// direction = -direction ; //方向を反転
//}
//if (direction == 1) {
// arc(x, 300, radius, radius, 0.52, 5.76); //右向き
//} else {
// arc(x, 300, radius, radius, 3.67, 8.9); //左向き
//}
//background(0);
float y1 = offset + sin(angle) * scalar;
float y2 = offset + sin(angle + 1.0) * scalar;
float y3 = offset + sin(angle + 3.0) * scalar;
fill(#40e0d0, 127);
ellipse(130, y1, 100, 100);
fill(#6a5acd, 127);
ellipse(270, y2, 70, 70);
fill(#ff1493, 127);
ellipse(390, y3, 80, 80);
angle += speed2;
}