size(300,500);
ellipse(75,200+75,150,150);
ellipse(75+150,200+75,150,150);
ellipse(75,200+75+150,150,150);
ellipse(75+150,200+75+150,150,150);
==============================================================
size(300,500);
ellipse(50,200+50,100,100);
ellipse(50+100,200+50,100,100);
ellipse(50+100+100,200+50,100,100);
ellipse(50,200+50+100,100,100);
ellipse(50+100,200+50+100,100,100);
ellipse(50+100+100,200+50+100,100,100);
ellipse(50,200+50+100+100,100,100);
ellipse(50+100,200+50+100+100,100,100);
ellipse(50+100+100,200+50+100+100,100,100);
==============================================================
size(300,500);
for(int y=0;y<n;y++){
for(int x=0;x<n;x++)
{
ellipse(w+x*R,200+w+y*R,R,R);
}
}
==============================================================
size(300,500);
//因為寬度是300,有3個球去分,每個球分到直徑100半徑50
//因為寬度是300,有n個球去分,每個球分到直徑300/n,半徑300/n/2
int n=5;
int R=300/n, w=R/2;
for(int y=0;y<n;y++){
for(int x=0;x<n;x++)
{
ellipse(w+x*R,200+w+y*R,R,R);
}
}
==============================================================
會放大的圓形
void setup(){
size(300,500);
}
int n=5;
int R=300/n, w=R/2, RR=0; //會變動的R直徑,我們叫他RR
void draw(){
//因為寬度是300,有3個球去分,每個球分到直徑100半徑50
//因為寬度是300,有n個球去分,每個球分到直徑300/n,半徑300/n/2
for(int y=0;y<n;y++){
for(int x=0;x<n;x++){
ellipse(w+x*R,200+w+y*R,RR,RR); //從小變到大...
}
}
if(RR<R) RR++; //如果還沒超過範圍,++從小變到大...
==============================================================
void setup(){
size(300,500);
}
int n=3, RR=0; //會變動的R直徑,我們叫他RR
void draw(){
background(0);
int R=300/n, w=R/2;
for(int y=0;y<n;y++){
for(int x=0;x<n;x++){
ellipse(w+x*R,200+w+y*R,RR,RR); //從小變到大...
}//因為寬度是300,有n個球去分,每個球分到直徑300/n,半徑300/n
}
if(RR<R) RR+=R/10; //如果還沒超過範圍,++從小變到大...
else{
n++;
RR=0;
}
}
==============================================================
void setup(){
size(300,500);
}
int ansX=1,ansY=2; //答案!
int n=3, RR=0; //會變動的R直徑,我們叫他RR
void draw(){
background(0);
int R=300/n, w=R/2;
for(int y=0;y<n;y++){
for(int x=0;x<n;x++){
if(x==ansX && y==ansY) fill(128);
else fill(255);
if( dist(mouseX,mouseY,w+x*R,200+w+y*R)<w) fill(255,0,0);
ellipse(w+x*R,200+w+y*R,RR,RR); //從小變到大...
}//因為寬度是300,有n個球去分,每個球分到直徑300/n,半徑300/n
}
if(RR<R) RR+=R/10; //如果還沒超過範圍,++從小變到大...
}//為了讓速度一致,改成RR+=R/10變成很快
void setup(){
size(300,500);]\
}
int ansX=1,ansY=2; //答案!
int n=3, RR=0; //會變動的R直徑,我們叫他RR
void draw(){
background(0);
int R=300/n, w=R/2;
for(int y=0;y<n;y++){
for(int x=0;x<n;x++){
if(x==ansX && y==ansY) fill(240); //答案要有點不同
else fill(255); //白色
if( dist(mouseX,mouseY,w+x*R,200+w+y*R)<w){ //現在的mouse選中誰
if(mousePressed && x==ansX && y==ansY){
ansX=int(random(n));
ansY=int(random(n));
}
}
ellipse(w+x*R,200+w+y*R,RR,RR); //從小變到大...
} //因為寬度是300,有n個球去分,每個球分到直徑300/n,半徑300/n
}
if(RR<R) RR+=R/10; //如果還沒超過範圍,++從小變到大...
} //為了讓速度一致,改成RR+=R/10變成很快
==============================================================
void setup(){
size(300,500);
colorMode(HSB,256); //TODO:改色彩系統
}
int ansX=1,ansY=2; //答案!
int n=3, RR=0;
int H=0;
void draw(){
background(0);
int R=300/n, w=R/2;
for(int y=0;y<n;y++){
for(int x=0;x<n;x++){
if(x==ansX && y==ansY) fill(H-10,243,234); //答案要有點不同
else fill(H,255,255); //白色
if( dist(mouseX,mouseY,w+x*R,200+w+y*R)<w){ //現在的mouse選中誰
if(mousePressed && x==ansX && y==ansY){
ansX=int(random(n));
ansY=int(random(n));
H+=20; //TODO:改色彩系統
if(H>256) H=0;
}
}
ellipse(w+x*R,200+w+y*R,RR,RR); //從小變到大...
}//因為寬度是300,有n個球去分,每個球分到直徑300/n,半徑300/n
}
if(RR<R) RR+=R/10; //如果還沒超過範圍,++從小變到大...
}//為了讓速度一致,改成RR+=R/10變成很快









沒有留言:
張貼留言