2019年9月19日 星期四

SamYeh's note7_Week02

互動技術概論
Week02

1. 製作圖卡畫圖


2. 合程背景+打卡機



PImage img;
void setup(){
  size(800,304);
  img = loadImage("cool.jpg");
  background(img);
  for(int x=0;x<800;x+=16){
    for(int y=0;y<300;y+=30){
      fill(255,0);
           rect(x,y,16,30);
    }
  }
}
void draw(){

   int nowX = mouseX/16*16,
   nowY = mouseY/30*30;
   if( mouseButton== LEFT){
    fill(0);
    rect(nowX,nowY,16,30);
    }
    if( mouseButton== RIGHT){
    fill(255,0);
    rect(nowX,nowY,16,30);
    }

}


3. 製作圖片藝術



PImage img;
void setup(){
  size(1024,800);
  img = loadImage("face.png");
}
void draw(){
  if(mousePressed){
    //rect(mouseX,mouseY,40,40);
    image(img, mouseX,mouseY);
 
  }

}

5. 打包檔案帶回家





6. 完成的作品

 


7. 可以消除畫錯的(使用陣列)



PImage img;
int point[][] = new int [800][300];
void setup(){
  size(800,304);
  img = loadImage("cool.jpg");

}
void draw(){
   background(img);
   int nowX = mouseX/16,
   nowY = mouseY/30;
   if( mouseButton== LEFT){
    point[nowX][nowY]=1;
 
    }
    if( mouseButton== RIGHT){
    point[nowX][nowY]=0;
    }
    for(int i=0;i<45;i++){
      for(int j=0;j<10;j++){
       fill(0);
       if(point[i][j]==1) rect(i*16, j*30 ,16,30);
      }
    }
}

沒有留言:

張貼留言

alanhc 互動技術-week17 [final]

回顧這學期的作品:  期中作業:LANDING:PLANET 賣點&特點: 炫麗的特效 物理(星球重力及降落)及粒子系統(噴射) 世界地圖可根據視角縮放 困難點: 重寫3次最終改寫成物件導向的CLASS寫法...