void setup(){ size(600,600); background(0,0,0); fill(255,0,0); rect(0,0,50,50); fill(255,127,39); rect(0,50,50,50); fill(255,255,0); rect(0,100,50,50); fill(0,128,0); rect(0,150,50,50); fill(0,128,255); rect(0,200,50,50); fill(255,255,255); rect(0,250,50,50); stroke(255,255,255); fill(0,0,0); rect(0,300,49,49); stroke(0,0,0); fill(255,255,255); rect(550,0,50,50); //小圓點點框框 ellipse(575, 25, 2,2); //小圓點點 rect(550,50,50,50); //中圓點點框框 ellipse(575, 75, 6, 6); //中圓點點 rect(550,100,50,50); //大圓點點框框 ellipse(575, 125, 10,10); //大圓點點 rect(550,150,50,50); fill(0,0,0); text("Save",563,180); stroke(255,255,255); //原線段粗細 strokeWeight(1); } void draw(){ if(mousePressed && mouseX&rt;550 && mouseY<50) strokeWeight(3); else if(mousePressed && mouseX&rt;550 && mouseY<100) strokeWeight(6); else if(mousePressed && mouseX&rt;550 && mouseY<150) strokeWeight(10); else if(mousePressed && mouseX<50 && mouseY<50) stroke(255,0,0); else if(mousePressed && mouseX<50 && mouseY<100) stroke(255,127,39); else if(mousePressed && mouseX<50 && mouseY<150) stroke(255,255,0); else if(mousePressed && mouseX<50 && mouseY<200) stroke(0,128,0); else if(mousePressed && mouseX<50 && mouseY<250) stroke(0,128,255); else if(mousePressed && mouseX<50 && mouseY<300) stroke(255,255,255); else if(mousePressed && mouseX<50 && mouseY<350) stroke(0,0,); else if(mousePressed) line(mouseX,mouseY,pmouseX,pmouseY); }
肚子沒有紋路的豆豆龍 |
(2) 心得感想
在今天這堂課中,完成了類似小畫家功能的作業
左邊可以選畫筆顏色,右邊可以選畫筆粗細
但是目前 save 功能沒有辦法用 ˊ ˇ ˋ
因為快要下課了,所以程式還來不及加進去
連龍貓肚子的紋路也來不及畫 Q Q
我會找時間把程式碼補完整的 :D
有空就再畫一張嘍 ~~~~
沒有留言:
張貼留言