75 lines
1.3 KiB
Text
75 lines
1.3 KiB
Text
float theta;
|
|
float x, y, d = 0.01;
|
|
|
|
float arcsin3(float x){
|
|
return (1.025*(x+pow(x,3)/6));
|
|
}
|
|
|
|
float arcsin1(float x){
|
|
return (1.11*x);
|
|
}
|
|
|
|
void setup(){
|
|
size(600,600);
|
|
theta = 0;
|
|
noStroke();
|
|
}
|
|
|
|
void draw(){
|
|
translate(300,300);
|
|
rotate(-PI/2);
|
|
|
|
x = cos(theta);
|
|
y = sin(theta);
|
|
|
|
if(theta < 0.01){
|
|
d = 0.01;
|
|
}else if(theta > 2*PI - 0.01){
|
|
d = -0.01;
|
|
}
|
|
theta += d;
|
|
background(0);
|
|
fill(0xFF*4/4);
|
|
arc(0,0,480,480,0,theta);
|
|
|
|
fill(0xFF*3/4);
|
|
if(arcsin3(y)>PI/4){
|
|
arc(0,0,400,400,0, PI*1/2-arcsin3(x) );
|
|
}else if(arcsin3(y)<-PI/4){
|
|
arc(0,0,400,400,0, PI*3/2+arcsin3(x) );
|
|
}else if(x>0){
|
|
if(y>0){
|
|
arc(0,0,400,400,0, arcsin3(y) );
|
|
}else{
|
|
arc(0,0,400,400,0, 2*PI+arcsin3(y) );
|
|
}
|
|
}else{
|
|
arc(0,0,400,400,0, PI-arcsin3(y) );
|
|
}
|
|
|
|
fill(0xFF*2/4);
|
|
if(arcsin1(y)>PI/4){
|
|
arc(0,0,320,320,0, PI*1/2-arcsin1(x) );
|
|
}else if(arcsin1(y)<-PI/4){
|
|
arc(0,0,320,320,0, PI*3/2+arcsin1(x) );
|
|
}else if(x>0){
|
|
if(y>0){
|
|
arc(0,0,320,320,0, arcsin1(y) );
|
|
}else{
|
|
arc(0,0,320,320,0, 2*PI+arcsin1(y) );
|
|
}
|
|
}else{
|
|
arc(0,0,320,320,0, PI-arcsin1(y) );
|
|
}
|
|
|
|
fill(0xFF*1/4);
|
|
if(x>0){
|
|
if(y>0){
|
|
arc(0,0,240,240,0, asin(y) );
|
|
}else{
|
|
arc(0,0,240,240,0, 2*PI+asin(y) );
|
|
}
|
|
}else{
|
|
arc(0,0,240,240,0, PI-asin(y) );
|
|
}
|
|
}
|