第一份程式
第二份程式,多了筆觸大小
第三份程式,背景色更改
第四份程式,多了函式,眼睛透過滑鼠游標X Y軸控制
第五份程式,多了刷新率
210927 week01
💛🔔
如何畫出企鵝?
首先要先下載Processing
要下載老師放在上課用軟體的3.5.4版本
(來點日常抱怨...什麼時候才能回學校上課嗚嗚嗚)
今天教的使用processing
畫圖很方便,簡單的幾句程式碼完成你所要的圖
size(600,600);//(1) 畫布大小
background(#30A4D8);//背景色
//(2) 顏色: 背景色、畫的顏色
rect(100,100, 400,400);//(3)方塊
ellipse(200,300, 30,30);//圓
先畫一隻企鵝
size(600,600);//(1) 大小
background(#30A4D8);//(2)背景色
stroke(204,102,0);//(5)筆觸色
strokeWeight(5);//線條粗細
rect(100,100, 400,400);//(3)方塊
ellipse(200,300, 30,30);//(4)圓
ellipse(400,300, 30,30);
ellipse(300,400, 200,100);
line(200,400, 400,400);
再來做嘴巴鼓起來的的企鵝
size(600,600);
background(128);
fill(255);//臉
noStroke();
rect(100,100,400,400);
stroke(51);
strokeWeight(5);//雙眼的長和寬
ellipse(200,300, 30,30);
ellipse(400,300, 30,30);
noStroke();
fill(#CC6600);//嘴巴
ellipse(300,400,200,100);
stroke(255);//嘴巴的線
line(200,400, 400,400);
1. Processing 3.5.4 windows64 版 (解壓縮後, 再使用)
2. Git for Windows (安裝後就可以使用。在Chrome 裡先登入GitHub網站,才能用git上傳)
3. Arduino (開發 Arduino 軟體介面)
4. CH341SER.EXE (MakerUNO 需要的 USB Serial 驅動程式)
筆觸填色
形狀
1.呆呆企鵝_框線板
程式碼:size(600,600);
background(#f08080);
fill(255);//填滿的
noStroke();//沒框線
rect(100,100,400,400);//正方形
//臉
stroke(128);
strokeWeight(5);//線寬度為5
ellipse(200,300,30,30);//左眼
ellipse(400,300,30,30);//右眼
noStroke();//沒框線
fill(#CC6600);
ellipse(300,400,200,100);//右眼
stroke(255);
line(200,400,400,400);//嘴巴
size(600,600);//(1)大小
background(#30A4D8);//(2)
stroke(204,102,0);//
strokeWeight(5);//
rect(100,100, 400,400);//
ellipse(200,300, 30,30);//
ellipse(400,300, 30,30);//
ellipse(300,400, 200,100);//
line(200,400, 400,400);//
畫一隻呆企鵝
size(600,600);//大小
background(#30A4D8);//背景
fill(255);//臉
noStroke();
rect(100,100,400,400);
stroke(128);//眼
strokeWeight(5);
ellipse(200,300, 30,30);
ellipse(400,300, 30,30);
noStroke();//嘴
fill(#CC6600);
ellipse(300,400, 200,100);
stroke(255);//嘴中間的線
line(200,400, 400,400);
另一隻呆企鵝
void setup(){
size(600,600);
}
void draw(){
background(#30A4D8);
fill(255);//臉
noStroke();
rect(100,100,400,400);
stroke(128);//眼
strokeWeight(5);
ellipse(200,300, 30,30);
ellipse(400,300, 30,30);
noStroke();//嘴
fill(#CC6600);
ellipse(300,400, 200,100);
stroke(255);//嘴中間的線
line(200,400, 400,400);
}
把設置背景跟畫臉的部分分開
然後
stroke(128);//眼
strokeWeight(5);
ellipse(200,300, 30,30);改成ellipse(mouseX,mouseY, 30,30);
ellipse(400,300, 30,30);
讓左眼跟著滑鼠移動
1.Processing設定
2.視窗&背景顏色
3.方塊&橢圓
4.填充色&筆的顏色&筆的粗細
5.滑鼠位置
全部程式碼
今天呢第一次上課,是的。
