2012年10月2日 星期二

WEEK04,HW04



void setup()
{
size(500,400);
background(255,255,255);

fill(255,128,128);
rect(0,0,50,50);
fill(0,128,255);
rect(0,50,50,50);
fill(128,255,128);
rect(0,100,50,50);
fill(255,255,128);
rect(0,150,50,50);
fill(255,128,64);
rect(0,200,50,50);
fill(255,255,255);
rect(0,250,50,50);
fill(0,0,0);
rect(0,300,50,50);
fill(121,121,121);
rect(0,350,50,50);
fill(255,255,255);
rect(0,400,50,50);

fill(255,215,227);rect(450,350,50,50);
fill(215,234,255);rect(400,350,50,50);



fill(255);
rect(450,0,50,50);
ellipse(475, 25, 2,2);
rect(450,50,50,50);
ellipse(475, 75, 6, 6);
rect(450,100,50,50);
ellipse(475, 125, 10,10);
rect(0,250,50,50);





strokeWeight(1);
}
void draw()
{
if(mouseX&rt;450 && mouseX<500 && mouseY&rt;0 && mouseY<50 && mousePressed)strokeWeight(3);
else if(mouseX&rt;450 && mouseX<500 && mouseY&rt;50 && mouseY<100 && mousePressed)strokeWeight(6);
else if(mouseX&rt;450 && mouseX<500 && mouseY&rt;100 && mouseY<150 && mousePressed)strokeWeight(10);

else if(mouseX < 50 && mouseY<50 && mousePressed)stroke(255,128,128);
else if(mouseX < 50 && mouseY<100 && mousePressed)stroke(0,128,255);
else if(mouseX < 50 && mouseY<150 && mousePressed)stroke(128,255,128);
else if(mouseX < 50 && mouseY<200 && mousePressed)stroke(255,255,128);
else if(mouseX < 50 && mouseY<250 && mousePressed)stroke(255,128,64);
else if(mouseX < 50 && mouseY<300 && mousePressed)stroke(255,255,255);
else if(mouseX < 50 && mouseY<350 && mousePressed)stroke(0,0,0);
else if(mouseX < 50 && mouseY<400 && mousePressed)stroke(121,121,121);

else if(mouseX&rt;450 && mouseX<500 && mouseY&rt;350 && mouseY<400 && mousePressed)save("001.png");
else if(mouseX&rt;400 && mouseX<450 && mouseY&rt;350 && mouseY<400 && mousePressed)loadImage("001.png");



else if(mousePressed)
{
line(mouseX,mouseY,pmouseX,pmouseY);
}
}

1 則留言: