2020年10月5日 星期一

WEEK-4

 Processing

顯示圖片:



PImage img;
PImage img2;
PImage img3;
void setup(){
  size(800,370);
  img = loadImage("image.jpg");
  img2 = loadImage("logo.png");
  img3 = loadImage("mouse.png");
}
void draw(){
  image(img, 0, 0);
  image(img2, 560,255, 240,115);
  image(img3, mouseX-55/2, mouseY-57/2, 55,57);
}

PImage img;
PImage img2;
void setup(){
  size(800,500);
  img = loadImage("map.png");
  img2 = loadImage("yoshi.png");
}
int x=0;
void draw(){
  if(mouseX>750)x--;
  image(img, x, 0);
  image(img2 ,mouseX-83/2, mouseY-135/2 ,83 ,135);
}
float x=250, y=200;
float vx=1.3, vy=-14;
void setup(){
  size(500,400);
}
void draw(){
  background(255);
  ellipse(x,y, 10,10);
  x+=vx; y+=vy;
  vy += 0.98;
  if(x>500 || x<0) vx = -vx*0.85;
  if(y>400 || y<0) vy = -vy*0.85;
}



沒有留言:

張貼留言