2024年9月9日 星期一

Week01 Processing

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


2. void setup(){
  size(500,500);
}

void draw(){
 if(mousePressed) background(255,0,0);
 else background(0,255,0);
}


3. 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 存檔
             ctrl - a 全選

4. void setup() {
  size(500, 500);
}

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

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


5. void setup() {
  size(500, 500);
}

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

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);
}


6. size(600,400);
background(#FFFFA2);
rect(100,100,400,200);
fill(#FFFFA2);
ellipse(300,200,100,100);

7. size(400,400);
fill(#FFDC0F);
noStroke();
//ellipse(50,50,100,100);
arc(50,50,100,100,0+1,PI*2-1,PIE);


8. size(400,400);
fill(#FFDC0F);
for(int x=0;x<400;x+=100){
  for(int y=0;y<400;y+=100){
arc(x+50,y+50,100,100,0+1,PI*2-1,PIE);
  }
}




沒有留言:

張貼留言