2012年10月2日 星期二

week04, HW04


 
void setup(){
  
background(0,225,255);
size(500,400);
fill(255,0,0);//紅rect(0,0, 50,50);
fill(0,255,0);//綠rect(0,50, 50,50);
fill(0,0,255);//藍rect(0,100, 50,50);
fill(0,0,0);//黑rect(0,150, 50,50);
fill(255,255,255);//白rect(0,200, 50,50);

rect(450,0,50,50);//細ellipse(450+25,0+25,5,5);
rect(450,50,50,50);//粗ellipse(450+25,50+25,10,10);
rect(450,100,50,50);
fill(0,0,0);
text("erase",455,140);//擦fill(255,255,255);
rect(450,150,50,50);
fill(0,0,0);
text("save",460,180);//存stroke(0,0,0);
strokeWeight(10);
}




void draw()
{
if(mouseX < 50 && mouseY&rt;250 && mouseY<300 && mousePressed )
{
strokeWeight(5);//細else if(mouseX < 50 && mouseY&rt;300 && mouseY<350 && mousePressed )
{
strokeWeight(10);//粗if(mouseX < 50 && mouseY<50 && mousePressed )
{
stroke(255,0,0);//紅
}
else if(mouseX<50 && mouseY<100 && mousePressed)
{
stroke(0,255,0);//綠
}
else if(mouseX<50 && mouseY<150 && mousePressed)
{
stroke(0,0,255);//藍
}
else if(mouseX<50 && mouseY<200&& mousePressed)
{
stroke(0,0,0);//黑
}
else if(mouseX<50 && mouseY<250&& mousePressed)
{ 
stroke(255,255,255);//白
}
else if(mousePressed)
{
line(mouseX,mouseY,pmouseX, pmouseY);
}
if(mouseButton ==LEFT&&mousePressed ==true &&mouseX &rt;=450 &&mouseY <=50)
strokeWeight(5);
if(mouseButton ==LEFT&&mousePressed ==true &&mouseX &rt;=450 &&mouseY <=100 &&mouseY &rt;=50)
strokeWeight(10);
if(mouseButton ==LEFT&&mousePressed ==true &&mouseX &rt;=450 &&mouseY <=150 &&mouseY &rt;=100)
stroke(0,225,255);
if(mouseButton ==LEFT&&mousePressed ==true &&mouseX &rt;=450 &&mouseY <=200 &&mouseY&rt;=150)
save("123.jpg");

}

沒有留言:

張貼留言