processing

This commit is contained in:
Nebel 2012-10-28 03:39:43 +09:00
parent 4fb1e24117
commit a8c55dd841
3 changed files with 170 additions and 0 deletions

View file

@ -0,0 +1,38 @@
void setup(){
size(361, 690);
background(0xff);
//face
translate(90,30);
//rinkaku
rect(0,0,180,180,60);
triangle(0,0,90,-30,180,0);
noStroke();
rect(0,0,185,60);
stroke(0);
//eyes
fill(0);
rect(60-2,90,4,60,2);
rect(120-2,90,4,60,2);
fill(0xff);
//hair
triangle(0,20,90,20,45,60);
triangle(90,20,180,20,135,60);
stroke(0xff);
rect(0,-1,180,22);
stroke(0);
translate(90,30);
triangle(-100,0,-180,180,-100,360);
triangle(100,0,180,180,100,360);
fill(0);
rect(-90-2-5,-45,4,90);
rect(90+5-2,-45,4,90);
fill(0xff);
//body
fill(0);
noStroke();
translate(0,150);
triangle(0,0,-120,300,120,300);
stroke(0);
line(-30,300,-30,300+180);
line(30,300,30,300+180);
}

View file

@ -0,0 +1,57 @@
float theta;
float x, y, d = 0.01;
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(theta < PI){
arc(0,0,400,400,0,(PI*1/2-(x+pow(x,3)/6)));
}else{
arc(0,0,400,400,0,(PI*3/2+(x+pow(x,3)/6)));
}
fill(0xFF*2/4);
if(x>0&&y>0&&((y+pow(y,3)/6) < PI*1/4)){
arc(0,0,320,320,0,(y+pow(y,3)/6));
}else if(y>0&&((PI*1/2-x*1.11) < PI*3/4)){
arc(0,0,320,320,0,(PI*1/2-(x+pow(x,3)/6)));
}else if(x<0&&((PI*2/2-y*1.11) < PI*5/4)){
arc(0,0,320,320,0,(PI*2/2-y*1.11));
}else if(y<0&&((PI*3/2+x*1.11) < PI*7/4)){
arc(0,0,320,320,0,(PI*3/2+x*1.11));
}else{
arc(0,0,320,320,0,(PI*4/2+y*1.11));
}
fill(0xFF*1/4);
if(x>0&&y>0&&((y*1.11) < PI*1/4)){
arc(0,0,240,240,0,(y*1.11));
}else if(y>0&&((PI*1/2-x*1.11) < PI*3/4)){
arc(0,0,240,240,0,(PI*1/2-x*1.11));
}else if(x<0&&((PI*2/2-y*1.11) < PI*5/4)){
arc(0,0,240,240,0,(PI*2/2-y*1.11));
}else if(y<0&&((PI*3/2+x*1.11) < PI*7/4)){
arc(0,0,240,240,0,(PI*3/2+x*1.11));
}else{
arc(0,0,240,240,0,(PI*4/2+y*1.11));
}
}

View file

@ -0,0 +1,75 @@
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) );
}
}