PImage img;
void setup()
{
img = loadImage("aaaa.jpg");
size(500,400);
fill(255,0,0);rect(0,0,30,30);
fill(0,0,255);rect(0,30,30,30);
fill(0,255,0);rect(0,60,30,30);
fill(0,0,0);rect(0,90,30,30);
fill(255,255,255);rect(0,120,30,30);
fill(255,255,255);
rect(470,0,30,30);
fill(0,0,0);
rect(470,30,30,30);
fill(255,255,255);
rect(470,60,30,30);
fill(0,0,0);
ellipse(485,75,25,25);
fill(255,255,255);
rect(470,90,30,30);
fill(0,0,0);
ellipse(485,105,10,10);
}
void draw()
{
if(mousePressed && mouseX<30 && mouseY<30) stroke(255,0,0);
if(mousePressed && mouseX<30 && mouseY<60 &&mouseY>30) stroke(0,0,255);
if(mousePressed && mouseX<30 && mouseY<90 &&mouseY>60) stroke(0,255,0);
if(mousePressed && mouseX<30 && mouseY<120 &&mouseY>90) stroke(0,0,0);
if(mousePressed && mouseX<30 && mouseY<150 &&mouseY>120) stroke(255,255,255);
if(mousePressed && mouseX>470 && mouseY<30) save("aaaa.jpg");
if(mousePressed && mouseX>470 && mouseY>30 && mouseY<60) image(img,0,0);
if(mousePressed && mouseX>470 && mouseY>60 && mouseY<90)strokeWeight(5);
if(mousePressed && mouseX>470 && mouseY>90 && mouseY<120)strokeWeight(1);
if(mousePressed) line(mouseX,mouseY,pmouseX,pmouseY);
}
84
回覆刪除