void setup(){
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(255,255,255);
rect(450,0,50,50);
fill(0,0,0);
ellipse(475,25,10,10);
fill(255,255,255);
rect(450,50,50,50);
fill(0,0,0);
ellipse(475,75,30,30);
}
void draw(){
if(mousePressed && mouseX<50 && mouseY<50) stroke(255,0,0);
else if(mousePressed && mouseX<50 && mouseY<100) stroke(0,255,0);
else if(mousePressed && mouseX<50 && mouseY<150) stroke(0,0,255);
else if(mousePressed && mouseX>450 && mouseY<50) strokeWeight(5);
else if(mousePressed && mouseX>450 && mouseY<100) strokeWeight(30);
else if(mousePressed)
line(mouseX,mouseY,pmouseX,pmouseY);
}
自製小畫家 有三個顏色 跟改變筆粗細大小
好好玩,有趣~!
85
回覆刪除