2012年9月25日 星期二

week03,HW03

1.
void setup(){
  size(600,600);
}
int x=100,y=100;
void draw(){
  fill(255,0,255);
  rect(x,y,100,100);

  fill(255,255,0);
  ellipse(mouseX,mouseY,100,100);
 
  x=(x+mouseX)/2;
  y=(y+mouseY)/2;
}

2.

void setup(){
  size(800,800);
}
float x,y;
void draw(){
  background(0,0,0);

PImage girl;
girl=loadImage("C:/Documents and Settings/s513s/桌面/01.JPG");
image(girl,mouseX-240,mouseY);

PImage boy;
boy=loadImage("C:/Documents and Settings/s513s/桌面/02.JPG");
image(boy,x,y);

 x=x*0.75 + mouseX*0.25;
 y=y*0.75 + mouseY*0.25;
}

1 則留言: