2024年9月9日 星期一

Han的紀錄 Week01 Processing入門介紹

 Week01-1

size(500,500);
background(255,255,0);














void setup(){

  size(500,500); //大小
}

void draw(){
  if(mousePressed) background(255,0,0); //紅色
  else background(0,255,0); //綠色
}
#按滑鼠變紅色

Week01-2









void setup(){
  size(500,500); //大小
}

void draw(){
  if(mousePressed) line(mouseX,mouseY,pmouseX,pmouseY);
}

快速鍵
Ctrl-C,Ctrl-V 複製,貼上
Ctrl-Z 還原
Ctrl-T 自動排版
Ctrl-N 新文件
Ctrl-S 存檔Save










void keyPressed(){
  if(key=='1') strokeWeight(1);
  if(key=='2') strokeWeight(5);
  if(key=='3') strokeWeight(10);
}







void keyPressed(){
  if(key=='1') strokeWeight(1);
  if(key=='2') strokeWeight(5);
  if(key=='3') strokeWeight(10);
  if(key=='4') stroke(255,0,0);
  if(key=='5') stroke(255,255,0);
  if(key=='6') stroke(0,255,0);
  if(key=='7') stroke(0,0,255);
  if(key=='8') stroke(255,0,255);
}









size(600,400);
background(#FFFFA2); ///色碼
rect(100,100, 400,200);
fill(#FFFFA2); ///填充色
ellipse(300,200,100,100);

Week01-3










size(400,400);
fill(#FFFFA2); ///填充色
noStroke(); //不要有邊線的筆觸
//ellipse(50,50,100,100);
arc(50,50,100,100,1,PI*2-1,PIE); //畫弧











size(400,400);
fill(#FFFFA2); ///填充色
for(int x=0;x<400;x+=100){
  for(int y=0;y<400;y+=100){
    arc(x+50,y+50,100,100,0+0.5,PI*2-0.5,PIE); //畫弧
  }
}


沒有留言:

張貼留言