2012年10月2日 星期二

week04 , hw04


void setup()
{
size(600,500);
background(255,255,128);

fill(0,128,255);
rect(0,0,50,50);
fill(128,255,64);
rect(0,50,50,50);
fill(255,128,0);
rect(0,100,50,50);
fill(255,128,255);
rect(0,150,50,50);
fill(0,0,0);
rect(0,200,50,50);
fill(255,0,0);
rect(0,250,50,50);

fill(255,255,255);
rect(0,300,50,50);
ellipse(25,325,2.5,2.5);

fill(255,255,255);
rect(0,350,50,50);
ellipse(25,375,5,5);

fill(255,255,255);
rect(0,400,50,50);
ellipse(25,425,10,10);

fill(255,255,255);
rect(0,450,50,50);
rect(20,465,15,15);

fill(255,255,255);
rect(550,200,50,50);

fill(255,0,255);
text("save",570,230);

stroke(170, 155, 50);
strokeWeight(10);
}
void draw()
{
if(mouseX<50 && mouseY&rt;300 && mouseY<350 && mousePressed) 
{ 
strokeWeight(2.5); 
} 
else if(mouseX<50 && mouseY&rt;350 && mouseY<400 && mousePressed) 
{ strokeWeight(5); 
} 
else if(mouseX<50 && mouseY&rt;400 && mouseY<450 && mousePressed) 
{
strokeWeight(10); 
}
else if(mouseX<50 && mouseY<50 && mousePressed) 
{ 
stroke(0,128,255); 
} 
else if(mouseX<50 && mouseY<100 && mousePressed) 
{ 
stroke(128,255,0); 
} 
else if(mouseX<50 && mouseY<150 && mousePressed) 
{ 
stroke(255,128,0); 
} 
else if(mouseX<50 && mouseY<200 && mousePressed) 
{ 
stroke(255,128,255); 
} 
else if(mouseX<50 && mouseY<250 && mousePressed) 
{ 
stroke(0,0,0);
}
else if(mouseX<50 && mouseY<300 && mousePressed) 
{ 
 stroke(255,0,0); 
}
else if(mouseX<50 && mouseY<500 && mousePressed) 
{ 
stroke(255,255,255); 
} 
else if(mouseX&rt;500 && mouseX&rt;200&&mouseY<250 && mousePressed)
{
saveFrame();
}
else if(mousePressed)
{
line(mouseX,mouseY,pmouseX,pmouseY);
}
} 

心得: 小畫家的程式碼好好玩唷 可以自己製作然後繪圖

1 則留言: