void setup(){ size(500,500); background(0,0,0); //noStroke(); //左邊的顏色fill(255,0,0);//紅rect(0,0,50,50); fill(255,200,0);//黃rect(0,50,50,50); fill(80,255,80);//綠rect(0,100,50,50); fill(50,50,255);//藍rect(0,150,50,50); fill(55,50,50);//灰rect(0,200,50,50); fill(255,255,255);//白rect(0,250,50,50); fill(255,255,255); rect(450,0,50,50); fill(255); rect(450,50,50,50); rect(450,100,50,50); fill(0,0,0); ellipse(475, 25, 2,2); fill(0,0,0); ellipse(475, 75, 6, 6); fill(0,0,0); ellipse(475, 125, 10,10); fill(255,255,255);//存檔框框rect(0,300,50,50); fill(255,255,255);//讀檔框框rect(0,350,50,50); } int www=5; void draw(){ if(mousePressed && mouseX<50 && mouseY<50) stroke(255,0,0); else if(mousePressed && mouseX<50 && mouseY<100) stroke(255,200,0); else if(mousePressed && mouseX<50 && mouseY<150) stroke(80,255,80); else if(mousePressed && mouseX<50 && mouseY<200) stroke(50,50,255); else if(mousePressed && mouseX<50 && mouseY<250) stroke(55,50,50); else if(mousePressed && mouseX<50 && mouseY<300) stroke(255,255,255); else if(mousePressed) line(mouseX, mouseY, pmouseX, pmouseY);//畫線 else if(mousePressed && mouseX<50 && mouseY<350) save("123.png"); //存檔 else if(mousePressed && mouseX<50 && mouseY<400){ //讀檔 PImage img = loadImage("123.png"); image(img,0,0,500,500); } 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); }
2012年10月2日 星期二
Week04,HW04
(1)自己的小畫家
訂閱:
張貼留言 (Atom)
85
回覆刪除