2023年9月14日 星期四

Week 1 Here we go again


 WEEK 1-1 互動技術


1.使用電腦開啟Processing程式編輯嘗試調整字形並寫程式碼及測試執行





2.額外編寫一個背景顏色程式



WEEK 1-2 

1.編寫出void draw,它是有繪畫功能的程式碼



2.接下來要讓滑鼠可以畫出線條,額外編寫出以下
void draw()
{
   if(mousePressed)
   {
     line(mouseX,mouseY,pmouseX,pmouseY); 
   }
}

3.追加顏色按鍵設置,可透過指定按鍵調整線條顏色並畫出來void keyPressed()
{
   if(key=='1')stroke(255,0,0); 
   if(key=='2')stroke(0,255,0); 
   if(key=='3')stroke(0,0,255); 
}


4.多一個可存取當前繪畫畫面圖片的按鍵
if(key=='s'||key=='S') save("image.png");


5.增加可調整線條粗細的按鍵
 if(key=='+')strokeWeight(10); 加粗
 if(key=='-')strokeWeight(1); 減細

6.進一步優化粗細調整程式,可逐漸增加或減少線條體積
int w=1;
void keyPressed()
{
   if(key=='1')stroke(255,0,0); 
   if(key=='2')stroke(0,255,0); 
   if(key=='3')stroke(0,0,255); 
   if(key=='s'||key=='S') save("image.png");
   if(key=='+')strokeWeight(++w);
   if(key=='-')strokeWeight(--w);
   println(w);
}


























沒有留言:

張貼留言